Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure WebJob/Scheduler every 30 minutes from 8am-6pm?

When I go to configure a Schedule in the Azure management console, I'm only given the option of scheduling with an absolute end date/time (or never ending) and an interval.

enter image description here

So I can't, from this UI, schedule a job to every 30 minutes run every day from 8:00 AM to 6:00 PM only (i.e. don't run from 6:01 PM to 7:59 AM). Windows Task Manager and all other schedulers (cron, quartz) I've used before support the behaviour I want.

Is type of schedule supported at all in Azure, e.g. through the API or a hackish use of the Portal HTTP/JSON interfaces?

like image 924
makhdumi Avatar asked Nov 02 '25 15:11

makhdumi


1 Answers

You can use the built-in scheduling which is more flexible than the Azure one. You can learn more about how that works from this blog post http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/

The summary: create a file called settings.job that contains the following piece of json

{"schedule": "cron expression for the schedule"}

in your case the cron expression for "every 30 minutes from 8am to 6pm" would be 0,30 8-18 * * *

so the JSON you want is

{"schedule": "0,30 8-18 * * *"}

Keep in mind that this uses the timezone of the machine, which is UTC by default.

like image 175
ahmelsayed Avatar answered Nov 04 '25 19:11

ahmelsayed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!