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

后端 未结 2 1598
梦如初夏
梦如初夏 2021-01-21 02:48

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.

2条回答
  •  青春惊慌失措
    2021-01-21 03:36

    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.

提交回复
热议问题