Run recurrence job twice different time a day

Hi everyone,

I am using Hangfire for my project ang get some trouble.
I want to register a recurrence job running twice different time a day.
Ex:

RecurringJob.AddOrUpdate<RegisteredJob>(r => r.DailyCopyExternalFile(), Cron.Daily(12, 05), TimeZoneInfo.Local);
RecurringJob.AddOrUpdate<RegisteredJob>(r => r.DailyCopyExternalFile(), Cron.Daily(22, 15), TimeZoneInfo.Local);

But the time of the first job is override by the second job. So I only see a recurrence job in Hangfire server.
Please help me to solve this issue.
Thank in advance.

Hi,

This can be done like this:

RecurringJob.AddOrUpdate<RegisteredJob>("job1", r => r.DailyCopyExternalFile(), Cron.Daily(12, 05), TimeZoneInfo.Local);
RecurringJob.AddOrUpdate<RegisteredJob>("job2", r => r.DailyCopyExternalFile(), Cron.Daily(22, 15), TimeZoneInfo.Local);
1 Like

@bdanen thank for quick support. It really works well :smile: