Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a cron script under /etc/cron.d as so:

SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 0 * * * root /usr/local/sbin/app_logrotate >> /var/log/app-newday.log

This works but it executes always at 00:00 local time. The app in question uses UTC time ( I cannot change this). In my time zone this is a few hours behind resulting in the date tag on the daily logfile this application creates never being a new day.
I can't change the system localtime to UTC as other applications depend on localtime. I was wondering if it is possible to execute this cron only at 00:00 UTC while keeping my system localtime.
I have tried adding TZ=UTC to the cron script which did not work.
Does anyone know how this can be done?

share|improve this question
Why not just delay the crontab with the time difference ? If you can't, change your crontab by a cronjob in /etc/cron.d which uses date with the right options to know if it's time or not. – mveroone Mar 3 '14 at 9:16

In general the cron dameon will inherit the system's timezone. The only (easy) way I know is to set the TZ/CRON_TZ variable.

Did you restart the cron daemon after setting the TZ / CRON_TZ variable. This si required for cron to pick up the changes!

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.