如何在午夜之前到午夜之后(超过午夜)运行cron作业



如何创建从19:00到5:00运行的cron作业?这行不通:

* 19-05 * * .... 

我应该使用两个工作吗?👇

    * 19-23 * * .... 
    *  1-5  * * .... 

在某些发行版上可以:

* 19-23,0-5 * * *

查看这里:https://unix.stackexchange.com/questions/67158/crontab-entry-with-hour-range-going-over-midnight

我可以确认19-23,0-5可以在Ubuntu服务器16.04上工作。

是的,你需要行:

* 19-23 * * .... 
* 0-05 * * .... 

是的,你最终会分割它,像这样:

*/10 22-23 * * * logger "brooks was here"
*/10 00-05 * * * logger "brooks was here after midnight"

最新更新