如何设置cron每隔一个半小时运行某些命令?
问题描述:
如何设置cron每一个半小时运行某些命令?
How can I set cron to run certain commands every one and a half hours?
答
表达式在正常 cron
。
无需修改代码就可以做到最好:
The best you could do without modifying the code is:
0 0,3,6,9,12,15,18,21 * * * [cmd]
30 1,4,7,10,13,16,19,22 * * * [cmd]
这些可能是可压缩的,具体取决于cron的版本:
These might be compressible, depending on the version of cron you have to:
0 * / 3 * * * [cmd]
30 1-23 / 3 * * * [cmd]