Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On running

dpkg-reconfigure tzdata

in terminal and i get 2 different time on my machine

Local time is now:      Wed May  1 11:58:55 IST 2013.
Universal Time is now:  Wed May  1 06:28:55 UTC 2013.

The Problem is i want to run my cronjobs as per Local Time which is in IST, but they are running as per Universal Time UTC. Where do i need to make the necessary changes to acheive the desired behaviour ?

share|improve this question

migrated from stackoverflow.com May 1 '13 at 10:55

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Cron runs in the local time, but you can use a TZ= line on some systems to get it to run certain lines in different timezones. Other systems do not support this. If you have a TZ=UTC or TZ=GMT line, comment that out. If you don't, try adding TZ=IST on a line by itself, before your first entry. Using man crontab should document the TZ= line if your system supports it. Beware of daylight savings time issues if you specify the time zone.

If cron is really running in UTC, then there are several possibilities, including that your system is running in UTC, or that cron somehow got started with the TZ environment variable set to UTC. Type

date

to see what time your system is keeping. Make sure the TZ variable is not set in your shell when you do that (check with printenv TZ, which should not return anything).

Do

ps auxwwe | grep cron | grep TZ

to test for cron getting started with TZ set. If it returns nothing, TZ was not set when it started. If it is set, you'll need to trace back through your boot process to see where TZ got set, starting with the script that started cron.

There is more on cron and timezones here:

http://askubuntu.com/questions/54364/how-do-you-set-the-timezone-for-crontab

--jh--

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.