Search code examples
azurecronazure-webjobswebjob

How to configure azure webjob to run every 15 minute


Good afternoon, my friends, I would like to inform you that I am Brazilian so I would like to apologize for my English.

I have an azure webjob and want to set it to run every 15 minutes.

I'm deploying my webjob using Visual Studio and I already have my settings.job file. My problem is that when I set up to run every three minutes, it works perfectly, but when I set it to run every fifteen minutes, it works only minutes 0,15,30,45.

I hope you have managed to understand me

This is how my settings.job file is:

{ "schedule": "* */15 * * * *" }

Solution

  • The semantic of cron expressions is that they are absolute in term of time. So when you have 0 */15 * * * *, it means run at exactly 0 minutes after the hour, 15 minutes after, etc... There is no way to make it start from an arbitrary time.

    You wrote when I set up to run every three minutes, it works perfectly, but the behavior should be the same there: 0, 3, 6, 9, ...

    As an aside, note that your cron expression is not quite correct. Instead of * */15 * * * *, it needs to be 0 */15 * * * *. Otherwise, it will run every second for a whole minute, every 15 minutes.