如何每20分钟而不是小时运行cron

时间:2022-04-17 19:14:55

How to run cron every 20mins so like this:

如何每隔20分钟运行一次cron,如下所示:

00:20, 00:40, 01:20, 01:40 etc all the way but not at :00

00:20,00:40,01:20,01:40等一路但不是00:00

What should I put in crontab?

我应该把什么放在crontab中?

3 个解决方案

#1


20  

A line like

像一条线

20,40 * * * * /path/to/job

should trigger the job only whenever the minute part of the time is 20 or 40.

只有在分钟部分时间为20或40时才应触发工作。

If you are putting this in the system's crontab, add a username after that last star.

如果您将其放在系统的crontab中,请在最后一颗星之后添加用户名。

#2


3  

Add following line in crontab

在crontab中添加以下行

20,40 * * * * sh your_script.sh

20,40 * * * * sh your_script.sh

#3


-3  

*/20 * * * * /path/to/script.sh

* / 20 * * * * /path/to/script.sh

#1


20  

A line like

像一条线

20,40 * * * * /path/to/job

should trigger the job only whenever the minute part of the time is 20 or 40.

只有在分钟部分时间为20或40时才应触发工作。

If you are putting this in the system's crontab, add a username after that last star.

如果您将其放在系统的crontab中,请在最后一颗星之后添加用户名。

#2


3  

Add following line in crontab

在crontab中添加以下行

20,40 * * * * sh your_script.sh

20,40 * * * * sh your_script.sh

#3


-3  

*/20 * * * * /path/to/script.sh

* / 20 * * * * /path/to/script.sh