Azure WebJob not accepting a valid(?) CRON express

2019-04-06 07:22发布

问题:

I used crontab.guru to create a very simple CRON expression with the desired behavior to execute every day at 3:15 (AM) and this is the result: 15 3 * * *

Unfortunately for me, in Azure Portal this does not work, but if I add a leading 0 to my expression as such, 0 15 3 * * *, Azure will accept it, while crontab.guru will tell me it is wrong. The specification according to crontab.guru is: minute hour date month weekday.

The questions..

  • From where comes the discrepancy?
  • Is it Microsoft that in their traditional ways have a proprietary implementation with a leading zero?
  • If the standard is minute hour date month weekday, what does the leading zero describe?

回答1:

Have a look at the documentation:

  • Create a scheduled WebJob using a CRON expression
  • Timer trigger for Azure Functions

The CRON expression is composed of 6 fields: {second} {minute} {hour} {day} {month} {day of the week}.

So the first 0 describes the seconds.

*    *    *    *    *    *  command to be executed
┬    ┬    ┬    ┬    ┬    ┬
│    │    │    │    │    │
│    │    │    │    │    │
│    │    │    │    │    └───── day of week (0 - 7) (0 or 7 are Sunday, or    use names)
│    │    │    │    └────────── month (1 - 12)
│    │    │    └─────────────── day of month (1 - 31)
│    |    └──────────────────── hour (0 - 23)
│    └───────────────────────── min (0 - 59)
└────────────────────────────── second(0 - 59)