Simone
Simone

Reputation: 2430

My AzureWeb job ignore CRON expression and always run

I everyone, I have created a azure web job that should run daily every 5 minutes between 06.00am and 10pm.

This is the CRON expression I have used 0 0/5 6-10 * * *.

But for some reason the job run continuously, in the night too. The app service under the web job runs has the Always on set on On.

Here the code of my job:

static void Main(string[] args)
{
    MyEngine myEngine = new MyEngine();
    myEngine.Run();
}

myEngine.Run() run the following code:

Threading.Task.Run(() =>
{
    this.processTaskActivities();
}, this.cancellationTokenSource.Token);

I do not think this is the correct approach to run a web job, but I cannot change it...

Why my webjob run alway?

Thank you

EDIT I let you see how the job is configured:

enter image description here

PS.: The CRON expression is just to text according the time. To understand if it stops and if it runs when necessary

Upvotes: 0

Views: 211

Answers (1)

Jayendran
Jayendran

Reputation: 10960

You can create a file called settings.job along with your project and while deploying it will automatically detect the cron expression

settings.job

{"schedule": "0 0/5 6-10 * * *"}

Follow this Article

Upvotes: 0

Related Questions