How to schedule quartz job to run every 3 business days? - quartz-scheduler

Is it possible to schedule quartz job for every 3 business days ?
I'm seeing some examples time or specific day or month examples but how to write quartz expression every 3 business days with any month and any year ?
I have tried 0 0 */3 * 1-5 * but got error day-of-week and a day-of-month is not implemented.
Thanks

You cannot specify both a day-of-week (1-5) and a day-of-month (*/3) - one of them must be ?.
How about 0 0 0 ? * MON-FRI/3? Or 0 0 0 ? * MON,THU,TUE,FRI,WED?
EDIT: I tested above - it does not work (the / only seems to work for non-intervals, and the MON,THU,TUE,FRI,WED gets normalized to MON-FRI).
Looking at the source of the next-trigger-day-computation, I am quite confident now that "every 3 business days" is not possible with a single Quartz Scheduler Cron-Expression.
What possibly could work would be a collection of expressions. The "Related" links on the right might give some inspiration.

Related

Quartz.net Cron schedule that fires the first Saturday of every month

I'm using Quartz.net 3.0. How do I create a Cron schedule that fires the first Saturday of every month at 1 am?
If anyone else is checking this post with other variations of this cron schedule use http://www.cronmaker.com. For this question I got 0 0 1 ? 1/1 SAT#1 * which I tested and it looks fine.
I realize this question is a few months old, but in case you haven't already figured it out
"0 1 0 ? * SAT#1" should do the trick.
From the tutorial:
The ‘#’ is used to specify “the nth” XXX weekday of the month.
https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontriggers.html

How the target response Date is calculate in an Entiltment Process Milestone?

I am new to the Entitlement Process and Milestones using the OOTB implementations. In my org, two business hours (1 for SLA and 1 for OLA) set with different timezone. Each business hours configured to work 9 AM to 6 PM.
Extending the question from link : What will be the time trigger value based on the Business hour in salesforce? .
I have some SLA which has 5 days of deadline. As per formula ((EOB-SOB) * MPH) * NOBD), I need to get clarification on below if its correct:
EOB = Assume 5 days deadline, so 14/05/17
SOB = Today, so 09/05/17
MPH = 60 minutes
NOB = 5, What do I need to consider here? As No. of business day means 5 days
here, as 5 days of deadline?? Please clarify.
One thing which is observed for 5 days business: as per formula 5*60*5=1500 or 5*60*9 (no of business hours)=2700. As per 2nd logic I implemented, but OOTB not showing 5 days, its only showing the 2 days why ?
First of all, regarding: What will be the time trigger value based on the Business hour in salesforce?
EOB, stood for end of Business day, so 19:00 or 7 PM
SOB, was 10 AM in your sample
I have cleared up my original answer on that question as well.
Current question
Target Response (Days) showing 2 for 45 hours....
Ah, eh, yes tricky and often asked for. The 2 is simple 45/24 and then rounded off...
It is not business days!
There are some ideas on the Idea Exchange for this, but for now this is how it is.

Cron Expression: What exactly is the difference between ? and * in a cron expression?

It appears to me that both mean "any of the available values". What exactly in the difference between them?
* means every possible value in the field. ? means you don't care about the value. It's used when you have two fields that may contradict each other. The common example being the day of month and day of week fields. Consider, for example a cron specification for running at 10AM on the first day of every month:
0 0 10 1 * ? *
Now let's break it down:
Seconds: 0 - we want it to run on 10:00:00
Minutes: 0 - we want it to run on 10:00:00
Hours: 10 - we want it to run on 10:00:00
Day of month: 1 - we want it to run of the 1st of every month
Month: * - we want it to run on every month (e.g., January 1st, February 1st, etc.)
Day of week: ? - we don't care about the day of week. The cron should run on the 1st of every month, regardless of whether it's a Sunday, a Monday, etc.
Year: * - we want it to run on every year
From Quartz Scheduler
* ("all values") - used to select all values within a field. For example, "*" in the minute field means "every minute".
? ("no specific value") - useful when you need to specify something in
one of the two fields in which the character is allowed, but not the
other. For example, if I want my trigger to fire on a particular day
of the month (say, the 10th), but don't care what day of the week that
happens to be, I would put "10" in the day-of-month field, and "?" in
the day-of-week field. See the examples below for clarification.
The * character is used to specify all values. For example, "*" in the minute field means " every minute ".
The ? character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fields, but not the other. See the examples below for clarification.
You can look more here:
http://docs.netkernel.org/book/view/book:mod:cron/doc:mod:cron:cronexpression
Also if you need to create a Cron expression you can use this: http://www.cronmaker.com/
* means every time. According to the position, it will be:
every second, minute, hour, day, month.
? means that it would be
chosen by other field. So ? doesn't add filter, but it
wouldn't run every time.
? is used for setting the day, as it might be a day of month or the day of week. So if you choose the day of month (like the 1-st day of month), than you put ? in the day of week, by which you show, that it would be not every day of week, but only those days which are allowed by other conditions. And vice versa, if you set day of week, you put ? in the day of month.

Specifying a duration as a command line parameter

I'm writing up a command line utility that needs to take a duration parameter. Now my challenge is that the duration can span anywhere from minutes to months.
I had considered using just seconds, but passing in large numbers of seconds to communicate 1 month seemed unwieldy.
Are there any generally accepted ways of passing in a duration with such a high range?
The gnu date command does a very good job of this.
http://www.gnu.org/software/coreutils/manual/html_node/Examples-of-date.html
There is a ruby library with C code that parses these kinds of time specifications.
https://github.com/bbense/ruby-getdate
This one also seems very interesting
https://github.com/mojombo/chronic
Another convention that I've seen in more than one program is to use a letter qualifier after the number to indicate units other than seconds.
2m ( 2 minutes )
2h ( 2 hours )
2d ( 2 days )
2M ( 2 months )
'at' and 'find' both have similar options.
find uses two different options like -ctime and -cmin to take days and minutes respectively.
at will take many different forms (may have useful code you could copy) such as:
at now + 1 month
at 8am monday
Those are the two command line utilities that come to mind immediately.

Quartz repeat execution 5 times every day

I am using quartz to schedule my jobs,
I need to execute a job at 2:00am every day and repeat the execution 5 times every 10 minutes, any ideas?
the result should be: 2:00 2:10 2:20 2:30 2:40
Thanks in advance.
I would look at the Quartz CronTrigger, and particularly the usage of / to specify every 'n' minutes/hours whatever.
I think you would need
0 0,10,20,30,40 2 * * ?
to fire at 2am and then 2.10am-2.40am every 10 minutes.
Just specify the schedule times as a cron string for the CronTrigger like this:
0 0,10,20,30,40 2 * * *
Use a CronTrigger with a cron expression that describes the exact times you want it run. For every day at 2:00, 2:10, 2:20, 2:30, 2:40, use:
0 0,10,20,30,40 2 * * ?
A simple solution would be to simply have 5 tasks, one for every 10 minutes.