date command in crontab shows delayed(One Hour) output
Hi folks,
the date command shows the correct date and time, How ever, if the date command executed through crontab in any form of scrip the output shows as one hour delayed, similar to date -u..
Can some one help in this..
++++++++++++++++++++++++++++++++++++++++++
Date command perfectly shows
judi:root:/tmp# date
Fri Feb 15 15:08:03 MET 2013
judi:root:/tmp#
output of the script execution (delayed for one hour)
judi:root:/tmp# more test.out
130215-14:03
130215-14:04
130215-14:05
130215-14:06
130215-14:07
130215-14:08
judi:root:/tmp#
judi:root:/tmp# date
Fri Feb 15 15:08:10 MET 2013
judi:root:/tmp#
Sorry , I dont have any clue and totally confused.. Please be more specific on what else we can check..
Also I did not find any thing interesting (about time settings) in /etc/.profile..
I guess that the TZ is set on a per user basis but not systemwide. As cron has a very limited environment, it may not have TZ set correctly. You can set TZ in the crontab files.
The TZ is set properly in /etc/TIMEZONE, how do I check the TZ is set on per user basics,
The issue is faced by all users who running the date command through cron
In general, if I see the env command, all the servers are displaying the TZ=<timezone>, but this entry (TZ=<timezone>) is missing in this particular server, that too for all the users.. Hence I added the time zone settings in /etc/profile.. Now the cronjobs are giving the correct data and time (without any delay..)
My curiosity is from where this TZ=<timezone> variable is getting exported for servers, and why this server is not getting updated even the /etc/TIMEZONE file has proper entry..