manipulating/testing file times.

Denys Vlasenko vda.linux at googlemail.com
Sat Nov 27 20:24:48 UTC 2010


On Saturday 27 November 2010 02:19, David Collier wrote:
> > coreutils' touch actually allows relative dates and times:
> > 
> >   touch -d "+3 days" FILE
> > 
> > does what you would expect. That's a potential enhancement to 
> > Busybox.
> 
> That's very sexy, and pretty close to perfect.
> 
> What I'm trying to do is to do a dhcp request - if it fails I want to do
> another one, but only every 15 minutes or so. I'm not aware of a built-in
> capability of udhcpc to do that, so I need to SIGUSR1 it from time to
> time.

It has --tryagain option for that:

$ udhcpc --help
BusyBox v1.18.0 (2010-11-23 00:11:12 CET) multi-call binary.

Usage: udhcpc [-fbnqvoCR] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]
        [-H HOSTNAME] [-V VENDOR] [-x OPT:VAL]... [-O OPT]...

        -i,--interface IFACE    Interface to use (default eth0)
        -p,--pidfile FILE       Create pidfile
        -s,--script PROG        Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
        -t,--retries N          Send up to N discover packets
        -T,--timeout N          Pause between packets (default 3 seconds)
        -A,--tryagain N         Wait N seconds after failure (default 20)
        ...

> I can have a dedicated process which deals with this, but it is actually
> easier to debug if I have a file on the machine which has he "time" of
> the next moment when I will retry. Then my script just tests "now"
> against the file time.

And if the time is not reached, the script will do ... what?

-- 
vda


More information about the busybox mailing list