Does cronjob timing start from the moment it's created or is it preset?
I'm setting up a cronjob to run every 30 minutes on a Linux server.
When does the 30 minute countdown star开发者_Python百科t? Is it counted from the minute I created the cronjob or is it based on a preset 30 minute schedule?
For example:
If I create a cronjob at 9:32, set to run every 30 minutes, will it run at 9:32, 10:02, 10:32, 11:02...
Or is there a predetermined run time such as it's first run would be 10:00 then 10:30, 11:00, 11:30...
If you create a cron with:
*/30 * * * * /command/to/execute
it is the same as:
0,30 * * * * /command/to/execute
which means it will run twice; once on the hour and then 30 mins past the hour.
It doesn't matter what time you create it.
Another example:
*/29 * * * * /command/to/execute
is the same as:
0,29,58 * * * * /command/to/execute
So the cron will run at 00:00, 00:29, 00:58, 01:00, 01:29, 01:58
and so on.
(You can think of / as division. Every minute (*) is divided by 29...)
精彩评论