I have a problem with a user's crontab.
Crontab refuses to run any job unless it's scheduled to run every minute (* * * * *).
An soon as you edit the task to run, say, on minute 15 of every hour, it fails to run.
This runs ok every minute:
* * * * * touch /tmp/test01
This fails to run on minute 15 of every hour. It just won't run.
15 * * * * touch /tmp/test02
- What's causing this?
- How can it be solved?
OS is RedHat 4.
I always edit the cron with
crontab -e and
EDITOR is set to vi. I've changed back and forth between
15 * * * * (minute can change) and
* * * * * and the result is the same. It only likes five asterisks.
I followed @shane-h 's question and tested for
*/2 * * * * (every other minute) and it worked! Then I discovered something revealing:
I had made a test with this string
37 * * * * touch /tmp/prueba_777777
To my surprise the thing actually ran but look at the date of the file:
-rw-r--r-- 1 orashut dba 0 Aug 8 08:07 prueba_777777
Recently the server was set to the new Venezuela TimeZone, which is now -04:00, but used to be -04:30.
Whem you run the date command it shows the correct date. When you create a file, the file date in the FS is correct. But somehow cron jobs are running 30 minutes earlier. That's why when I scheduled a job for some minutes in the future it didn't work, because to the cron daemon that time had already passed. If I waited almost an hour it would have run at exactly minutes-30. That's why the touched file is 30 minutes earlier that the schedule's 37.
So the question now is:
It's evident that the cron daemon is working with the old timezone while the rest of the server is working with the new timezone.
How can I fix the cron daemon's understanding of the new timezone?