是否有可能每15分钟(超过每小时等)运行一次 cronjob,除了在凌晨3点?
我有另一个特殊的混蛋工作,我想运行在凌晨3点,但我不希望另一个运行在同一时间..。
0,15,30,45 0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * your cron job
With one cron line, no. With three, yes:
# Every 15 minutes except for 3:00-3:59 */15 0-2,4-23 * * * thejob # 3:15, 3:30, 3:45 15-45/15 3 * * * thejob # 3:00 dead 0 3 * * * otherjob
I made my own solution, but I wanted to see what other people thought of!
I put this on the top of my desired script. I wanted it to not run at the half hour either so it doesn't do it on both.
On top of the script:
if [ $(date +%M) = 00 ] || [ $(date +%M) = 30 ] then exit fi
The cron line:
*/15 * * * * ~/path/to/file
Hope anyone uses my solution too.