Why the time will change to another Timezone?
Hello~
I write a script using 'here document' syntax, for example:
#!/bin/ksh
mailx -s "This is a test mail" davis@flora.com<<EOF
`date`
That's it!!
EOF
And, I put it into cron job, when I got the email, I found the date time is slower 8 hours from the system time!! That is,
the system time is 'Tue May 29 11:14:44 CST 2007',
but the mail I got will be 'Tue May 29 03:14:44 EST 2007'!!
However, I run the script from command line, I got the correct time as system time. I am very confused at that, can anyone help?
Thanks!!
I>
# 2
Check 'grep TZ /etc/default/init' is the same as system environment, however, if run from cron job, the date will show +8 hr than system time!!But, if you run from command line, the date will be the same as system time..how strange it is,isn't it?
# 5
Hello,Guys,
I just reboot the system, and test the cron job again..You guess what?
The date time is correct from the email this time!!
I tried to recall what I've done to the system, then, I remembered that before the problem occurred, I just killed a wrong process, yes, it is 'cron' process, however, I start it by using '/etc/init.d/cron start' right after I found the mistake, and the problem was found when the cron job invoke at the assigned time..
I don't know if there's any relatiponship between them, just wondering the 'cron' process can't be start up by using /etc/init.d/cron manually?