Good morning Isaac, thanks for the response!  I was not restarting
crond after the time was changed.  I thought it would pickup the
adjustments automatically.  I'll redo the tests restarting crond each
time and report back.  Probably not today, but hopefully I can get
back with everyone tomorrow.

Thanks,
Dave


On 1/19/16, Isaac Dunham <[email protected]> wrote:
> On Mon, Jan 18, 2016 at 12:37:14PM -0500, David Henderson wrote:
>> 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!
>
> When testing these, do you restart *crond* so that the timezone applies?
> Do you use /etc/localtime for setting the system timezone?
>
>
> To check the environment of crond, you can do (as root):
> # tr '\0' '\n' < /proc/`pidof crond`/environ
>
> HTH,
> Isaac Dunham
>
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to