如何设置一个跨夜并每 15 分钟运行一次的 cron 作业

How to setup a cron job that spans the night and runs every 15mins

如何设置 cron 作业 运行 从周日到周四 2300 点到 0515 点(第二天早上)(工作在周五早上结束)

这是一项特定要求,因为我的 hostgator 服务器设置为芝加哥时间,我需要一份 运行 从周一到周五印度标准时间的工作。

您将需要三个 cron 表达式来准确实现您的要求:

  1. 23:00 - 23:59(周日至周四,每 15 分钟一班)

    */15 23 * * 0-4 command
    
  2. 00:00 - 4:59(周一至周五,每 15 分钟一班)

    */15 0-4 * * 1-5 command
    
  3. 5:00,5:15(周一至周五)

    0,15 5 * * 1-5 command
    

祝你好运!