Linux 每 5 分钟执行一次 Crontab
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11260406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 07:09:16 来源:igfitidea点击:
Crontab every 5 minutes
提问by Arnaud
How could i tell crontab to run every 5 minutes, but starting at the second minute of the hour. In other words, i would like to execute my script when minute % 5 = 2
.
我怎么能告诉 crontab 每 5 分钟运行一次,但从一小时的第二分钟开始。换句话说,我想在minute % 5 = 2
.
For example, my script should run at :
例如,我的脚本应该运行在:
08:02
08:07
08:12
08:17
...
Thanks for your help!
谢谢你的帮助!
采纳答案by Igor Chubin
There are two possibilities:
有两种可能:
2,7,12,17... command
*/5 .... sleep 120 ; command
- Write explicit all minutes in
crontab
- Run
sleep
command before the actual command
- 写清楚所有分钟
crontab
sleep
在实际命令之前运行命令