凌晨 4 点和下午 4 点运行 cron

Din*_*ero 3 unix linux cron

以下 cron 表达式cron(0 14 ? * MON-FRI *)基本上在周一到周五下午 4:00 运行。

我想知道是否可以修改表达式,以便我可以在每周一至周五的凌晨 4:00 和下午 4:00 运行某些内容。

Tim*_*and 6

使用此crontab线路运行时间command_name为周一至周五 4:00 和 16:00(上午 4 点和下午 4 点):

0 4,16 * * 1-5 command_name
Run Code Online (Sandbox Code Playgroud)

来自crontab手册

   The time and date fields are:

          field          allowed values
          -----          --------------
          minute         0-59
          hour           0-23
          day of month   1-31
          month          1-12 (or names, see below)
          day of week    0-7 (0 or 7 is Sunday, or use names)
Run Code Online (Sandbox Code Playgroud)