简体   繁体   中英

Crontab - How to make script run every 15 minutes from 12:00 PM to 03:00 AM

I have tried so many things. For example, I first tried the most logic by me

*/15 12-3 * * * script.sh

but the crontab doesn't allow me to save it like that so I tried

*/15 12-0,0-3 * * * script.sh

and once again the crontab doesn't allow me to save it. Now I lose one hour because it is running like this

*/15 12-23,0-3 * * * script.sh

Can you please help me with this problem. I am sure there is a way I just cannot find it.

*/15 0-3,12-23 * * * script.sh 

should do the trick. Note that ranges are inclusive, so the script will execute for all hours, without skipping any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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