2

My server was originally Eastern Time. But I used tzselect to change the timezone. Now typing date into the command line prints out the new timezone. But crontab still uses the old timezone to execute commands. How can I get crontab to use the new timezone? Is there something else that crontab uses for getting time/dates?

3
  • 1
    What happen if you just restart cron? I know that is ridiculous but... it is necessary for cron to get the new environment ! Commented Jul 29, 2017 at 21:59
  • Or if cron is calling a script, set the TZ variable at the beginning of the script. Commented Jul 29, 2017 at 22:22
  • I restarted cron using sudo service cron restart but still same thing. Also no I am calling a python script from my crontab. Commented Jul 29, 2017 at 22:30

1 Answer 1

0

Fixed. tzselect doesn't work. To change system wide time use: dpkg-reconfigure tzdata

1
  • FYI - It is a best practice (especially in large enterprises with multi-national offices) to have all systems, routers, switches, etc log using UTC. Users set their timezones locally. Definitely helps when troubleshooting network related issues and forensics of hacks, intrusions, and other anomalies. Commented Jul 30, 2017 at 1:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.