简体   繁体   English

每天从上午8点至晚上8点以20分钟的间隔进行Cron作业

[英]Cron job every day from 8AM to 8PM at 20 minutes interval

How to run cron job every day from 8:00 AM to 8:00 PM at 20 minutes interval eg cron job should start at 8:00 AM every day, then run at 8:20 AM then 8:40 AM then 9:00 AM up to 8:00 PM . 如何每天20分钟间隔从8:00 AM8:00 PM运行cron job例如cron作业应从每天8:00 AM开始,然后在8:20 AM然后8:40 AM然后9:00 AM 8:00 PM8:00 PM Thanks. 谢谢。

EDIT: How to Implement it with ruby whenever gem. 编辑:如何whenever宝石与红宝石实现它。

Just use two cronjobs: 只需使用两个cronjobs:

*/20 8-19 * * * /your/script
0 20 * * * /your/script

That is: 那是:

  • one to run every 20 minutes from 8 to 19 hours 8至19小时每20分钟运行一次
  • one to run at 20.00. 一个以20.00运行。

As a reminder, this is the format for a cronjob: 提醒一下,这是cronjob的格式:

 +---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 |  |  |  +------- month (1 - 12)
 |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
 |  |  |  |  |
 *  *  *  *  *  command to be executed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM