Apply Year in Cron format


#1

Hi,
I want to apply year in cron. But it shows error if I add a component for year in cron like “0 18 1 5-11/1 * *”. Is it possible to create Scheduler starting from Dec 7th, 2015 to Jan 10th, 2016.


#2

this can be really handy for running jobs on a specific date only
… and this recurringjob can also be started manually in the ui then.


#3

How could you allow a user to schedule a job to run once at a specific time?

You cannot use a recurring job (RecurringJob.AddOrUpdate) because you can’t specify the year. If you could, you could schedule it and then potentially remove (by name) it once it was done, if you wanted to tidy up.

I suppose you could use a delayed job (BackgroundJob.Schedule) and calculate the necessary offset, but then you lose the ability to manipulate the job, e.g. you can’t easily remove it or change the run time because you only get to name recurring jobs.

It seems like someone ought to have run into this problem before. Any suggestions? Any plans to support years or naming jobs that aren’t recurring?

Thanks.


#4

Hi, @Ning
This is 2019 !
still i cannot find any solution for this situation,
if anyone knew how handle these kind of edge cases
kindly share how to get around it!