We left Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

How to AddOrUpdate RecurringJob for every 2 hours


We are using abp and hangfire.

Upgraded to HFA core 1.7.3 and abp.hangfire to 4.6.
Just wondering how do we set 2 hourly job.

Best Regards,

When adding the recurring job, you have to use this cron expression so that it runs every 2 hours :
* */2 * * *

reference : contab.guru

Hi Steven,

Thanks for the expression. We are using Corn.Hourly(…), Corn.Daily()
What does that equvalent using Corn.?

Best Regards,

If you could use Cron.HourInterval(2) but it’s deprecated and will be removed in 2.0.0, so i would suggest using the Cron expression * */2 * * *.

From what i can understand, The Cron class just returns Cron expressions, so it practically makes no difference.

1 Like

β€œ* */2 * * *” - this will run for each min and each two hour.
If you need it to be run each two hours only then use, β€œ0 */2 * * *”.