Link to home
Start Free TrialLog in
Avatar of JR
JR

asked on

How to schedule the quartz.net job that executes last working day every of two months

Hi Expert,

How to schedule the quartz.net job that executes last working day every of two months

Thanks,
JR
Avatar of Mlanda T
Mlanda T
Flag of South Africa image

Your cron expression would be :

0 0 15 LW 1/2 ?

The 15 is hours. So this cron will run in last weekday of every month at 3pm. I assume weekday=working day

The 1/2 is for month. Starting month 1, every 2 months.  

Test it here : http://www.cronmaker.com
Avatar of JR
JR

ASKER

On the schedule holiday should be considered.
Then you are not looking for a cron expression. A cron expression cannot factor in other date lookups and such. You will have to find an alternative implementation.
You can manage things by having the job reschedule itself if it fires on a holiday.

So your cron trigger can still run as intended, BUT if your Job it picks up that it is a holiday... it can create a new once-off schedule for itself to run on the next business day or something... OR at the end of  run, you can check when the next scheduled run will be, see if it's a holiday. If it is a holiday, create a once-off schedule to run a day before... your cron-based job will still run as usual...

Something like that.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can configure calendars in quartz.net via the ICalendar interface which comes with several default implementations... and it would then not fire of the holidays. But it would not do the rescheduling. It will just skip those days, which in your case, without the rescheduling, would result in quite a big gap.