Reshma
Reshma

Reputation: 446

Hangfire schedule job with specific user defined time

Is there any way to schedule a daily background job in Hangfire with a specific time?

For example, I want to run the background job for the specific time 10.00,13.00,17.00,1.00.

Is there any way to do this?

Upvotes: 0

Views: 619

Answers (1)

Jamie Rees
Jamie Rees

Reputation: 8183

Currently hangfire recurring background jobs only support CRON expressions.

What I would recommend you do is to set up multiple recurring jobs (that call the same code) but with different expressions to meet your time requirements.

e.g.

Job 1 - 0 0 10 1/1 * ? *
Job 2 - 0 0 13 1/1 * ? *
Job 3 - 0 0 17 1/1 * ? *
Job 4 - 0 0 1 1/1 * ? *

Upvotes: 1

Related Questions