Misunderstanding about executing once in n minutes (*/n) in crontab

Recently there is a scheduled task on the server, I set it as:

*/25 * * * * ccc /xxx/xxx

 Then tell the test classmates: Execute once every 25 minutes;

 In order to confirm, the test students asked again: Is it executed every 25 minutes?

I'm not too sure about this question. . . (Actually, when I set 25, my heart was already beating drums...)

Because the examples given in the various "crontab details" on the Internet are:

*/1 // means to execute once every minute

*/5 // means to execute every 5 minutes

*/10 // means to execute every 10 minutes

But 1, 5, and 10 are all divisible by 60. What about 25

So I did a test:

*/25 * * * * /usr/local/bin/php "/var/www/html/cron.php"

php code:

<?php

mkdir('/var/www/html/'.date('H-i-s',time()));

?>

 

And the result is:

The execution time is: 0 minutes, 25 minutes, 50 minutes every hour, not 0, 25, 50, 15, 40. . .

That is, every time a new hour is entered, the minutes are recalculated.

So, "*/n * * * *" is not when n is not divisible by 60: execute every n minutes

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326386657&siteId=291194637