Configure cron job that is executing every 15 minutes on Hangfire

We can also use the following code line to schedule job for every 15 minutes.

RecurringJob.AddOrUpdate(() => Console.Write("Recurring"), Cron.MinuteInterval(15));

Looking at Hangfire.Cron class I don't know if it's possible.

A workaround would be to create four different schedules i.e:

RecurringJob.AddOrUpdate(
    () => Console.WriteLine("Transparent!"), 
    Cron.Hourly(0));

RecurringJob.AddOrUpdate(
    () => Console.WriteLine("Transparent!"), 
    Cron.Hourly(15));

RecurringJob.AddOrUpdate(
    () => Console.WriteLine("Transparent!"), 
    Cron.Hourly(30));

RecurringJob.AddOrUpdate(
    () => Console.WriteLine("Transparent!"), 
    Cron.Hourly(45));

Currently I am using this approach:

RecurringJob.AddOrUpdate(() => Console.Write("Recurring"), "*/15 * * * *");

And is working like a charm.

Reference to my question in Hangfire forums: http://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533

Tags:

C#

Hangfire

Ncron