Consider the following cron job:
* 22-23 * * * /usr/bin/curl -u username:paswword http://api.example.com/api/test2.php
Now, according to this, the cron job must run every minute starting from 22h00 (UTC) but it doesn't. It starts before that time and also not for the full hour. So I wrote the execution time to a database table, just to see what's going on. Here is what I get:
The systemDateTime
represents when the cron job executes. As you can see, it only executed 6 times and it started about 6 minutes before the scheduled time.
Is this system configuration related? The cron job is on a Apache shared server. Am I missing something or what?
Update: I use the following PHP code to get the system date time and my timezone date time:
$systemDateTime = date('Y-m-d H:i:s');
$dateNow = new DateTime("now", new DateTimeZone('GMT+2'));
$zoneDateTime = $dateNow->format('Y-m-d H:i:s');
* 22-23 * * *
is actually two hours and should run from 22:00 to 23:59 inclusivedate; date +'%Z %z'; date --utc
. I'm also wondering what timezone yourcrontab
is configured to usecron
because%
is a special character there)