date: shell vs. cron. Why aren't they the same?
Like most scientific organizations, we specify time in UTC. Recently, a program that is run from the cron started using the wrong time. I discovered that the 'date' command was now outputting EST instead of UTC. I then discovered that the current version of /etc/localtime on this machine was installed the day that the behavior of 'date' changed and that /etc/localtime is now a link to /usr/share/zoneinfo/US/Eastern. Now for the confusing part: 'date' still outputs UTC when not run in a cron job. Whether I type in 'date' or put 'date' in a C shell script, I get UTC. But if I run that same C shell script as a cron job, it switches to EST. I can accept that the new /etc/localtime changed the behavior of 'date', but I don't understand why the change only occurs in cron jobs. Can anyone explain this?
(the environment variable TZ on this machine is set to UTC0.)
|