我试图从早上8:30到晚上9:30每5分钟完成一次cron工作.我一直在网上搜索,这是我想出的:
30,35,40,45,50,55 8 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
*/5 9-21 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
5,10,15,20,25,30 22 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
Run Code Online (Sandbox Code Playgroud)
我看过cron作业生成器,但它们似乎没有满足半小时开始/结束的要求.有没有人有更好或更简洁的解决方案?
30-59/5 8 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
*/5 9-20 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
0-30/5 21 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1
Run Code Online (Sandbox Code Playgroud)
也应该工作,更容易阅读.