erotavlas
erotavlas

Reputation: 4475

Azure cron expression for once every hour starting at specific time

I'm trying to create scheduled job, using cron expression but Azure is not accepting any of the expression I create. For example I want to start a job that runs every hour starting at 3:30

0 30 3/1 * * * *

But according to Azure this is invalid. According to other sites this is valid.

Upvotes: 0

Views: 1114

Answers (2)

RAS
RAS

Reputation: 3385

Do you mean every hour starting from 3:30am and ending at midnight (11:30pm) every day?

This should work:

0 30 3-23 * * *

Or from 3:30pm to 11:30pm:

0 30 15-23 * * *

Update:
If you want your first run to happen at a specific time and then recur every n minutes, then Azure Webjob Cron won't help, I think. They do not support extended syntax. In fact, they use modified ncrontab implementation, so you can try to dig into that.

But - if you have a specific need to start cron at a specific time and run indefinetely, you have several options:
Option 1: Use Azure Scheduler. It has Start At Specific Time Setting
Option 2: Add a check to your code that will check date/time and then run Cron every 30 minutes.

Upvotes: 1

Dave X
Dave X

Reputation: 5127

You could separate clearing/setting an inhibition flag into separate jobs:

0 30 * * * * if [ ! -e /tmp/inhibitor ] ; then job.sh ; fi
0 0  0 * * * touch /tmp/inhibitor
0 29 3 * * * rm -f /tmp/inhibitor

Upvotes: 0

Related Questions