manipulating/testing file times.

Denys Vlasenko vda.linux at googlemail.com
Fri Nov 26 11:29:27 UTC 2010


On Fri, Nov 26, 2010 at 11:00 AM, David Collier
<from_busybox_maillist at dexdyne.com> wrote:
> Possibly a bad place to ask, but I'm trying to do stuff in busybox/ash
> which involves time delays, or rather "alarms".
>
> I could do it with lots of little processes just sitting there going
> "sleep 34600", but it isn't very elegant.
>
> One idea I have is to touch a file, but set it's date to say, 3 days in
> the future. then use if[ ... -ot ] to trigger my action.

I have no idea what you mean by the above.

> Can anyone tell me if there is anything around as standard that might
> allow me to do the equivalent of
>
> touch /tmp/fred "+3days"

plus3days=$(date '+%Y-%m-%d %H:%M:%S' -D '%s' -d $((`date '+%s'` +
3*24*60*60)) )
touch -d "$plus3days" FILE

Note that date -D is a busybox extension.

-- 
vda


More information about the busybox mailing list