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?
Have a look at the documentation:
The NCRONTAB expression is composed of 6 fields: {second} {minute} {hour} {day} {month} {day of the week}. A CRON expression has only 5, without the seconds.
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)
来源:https://stackoverflow.com/questions/37836520/azure-webjob-not-accepting-a-valid-cron-expression