I am running a single instance cron job for certain task. My script looks like below:
# every hour interval
0 * * * * php /project/yii daily/order
# every 30 minutes interval
*/30 * * * * php /project/yii daily/sample
I am using https://crontab.guru/
to get the values. The scheduling works but for order
, I set it to run every hour interval but instead it runs every five hours instead. I checked the path and script and it is correct.
I was wondering why is does not run hourly as set?
0 * * * * date >> /tmp/test_x.txt
. Also "every 5 hours": does it start over at 0:00 every midnight, or does it run at 01:00 the second day (i.e. strict 5-hour intervals), which would indicate some timer other than cron.A field may be an asterisk, which always stands for first-last
which for hour is 0-23. If this is needed for hour, then you also need */1 for day of month.php
code contains its own timing constraints, or waits for some external event, and skips the missing cron events itself. Maybe it runs for around 4.5 hours, and refuses to allow two copies of itself to run simultaneously. Test by making the command part:date >> /tmp/test_x.txt && php /project/yii daily/order
. Then you can see cron log each hourly execution, and then check to see php running (or not) intop
.