wierd cron behavior
David Henderson
dhenderson at digital-pipe.com
Mon Jan 18 17:37:14 UTC 2016
Good morning all, so I'm continuing in my attempt to get cron working.
I have worked around some of the deficiencies of the BB implementation
(e.g. @startup, /etc/cron.d), however, I can't seem to get cron to
work with local times instead of UTC - meaning that I have to create
crontabs using UTC time (not desired) and not local time (desired).
At first I thought it was either the system time or hardware clock not
being set correctly, so I began adjusting times with both of those:
$ unset TZ
$ ntpd -n -q -p pool.ntp.org
$ hwclock -w -u
$ export TZ='EST+5EDT'
$ date -u; hwclock -u
Mon Jan 18 17:08:15 UTC
Mon Jan 18 12:08:16 2016 -0.687957 seconds
$ date; hwclock --localtime
Mon Jan 18 12:08:18 EST
Mon Jan 18 17:08:19 2016 -0.176678 seconds
$ cat /var/spool/cron/crontabs/root
9 12 * * * date > /tmp/test.txt
The above job failed, but when I change it to:
$ cat /var/spool/cron/crontabs/root
10 17 * * * date > /tmp/test.txt
It seems to work. So I figured, lets see what happens when I set the
hardware clock to local time:
$ unset TZ
$ ntpd -n -q -p pool.ntp.org
$ export TZ='EST+5EDT'
$ hwclock -w --localtime
$ date; hwclock
Mon Jan 18 12:17:58 EST 2016
Mon Jan 18 12:17:59 2016 -0.312997 seconds
$ date -u; hwclock -u
Mon Jan 18 17:18:15 UTC 2016
Mon Jan 18 07:18:16 2016 -0.781702 seconds
The above job works correctly when using:
19 17 * * * date > /tmp/test.txt
But not when using:
21 12 * * * date > /tmp/test.txt
Any help would greatly be appreciated!
Dave
More information about the busybox
mailing list