Recurrent Tasks
Performing Recurrent Tasks — Hangfire Documentation
Recurring job registration is almost as simple as background job registration – you need to write a single line of code, but you also need to specify an identifier you can use to refer to your job later. The call to AddOrUpdate method will create a new recurring job or update existing job with the same identifier.
https://docs.hangfire.io/en/latest/background-methods/performing-recurrent-tasks.html
Add or Update
You can create recurrent tasks using CRON and a unique case-sensitive identifier. The task with the given identifier will be added or updated.
RecurringJob.AddOrUpdate("some-id", () => Console.Write("Easy!"), Cron.Daily);
// or
RecurringJob.AddOrUpdate("some-id", () => Console.Write("Powerful!"), "0 12 * */2");
Remove
RecurringJob.RemoveIfExists("some-id");
Trigger
You can also Trigger recurring jobs. This will make the job trigger now, but it will not affect when the job executes in the future. Aka, if it normally runs Daily at 12:00, and you trigger it now at 8:00, it will execute now at 8:00, and all future executions will continue to execute at 12:00.
RecurringJob.Trigger("some-id");