My goal is to trigger a report every first weekday of the month at 7AM (7/1/15,8/3/15,9/1/15, etc.)
I am using the following cron expression: H 7 1-3/3 * 1-5
It runs on July 1, but it is not scheduled next to run on August 3, but on September 1. How can I get it to run on the first weekday of every month?
I am using the following help guide:
MINUTE Minutes within the hour (0–59)
HOUR The hour of the day (0–23)
DOM The day of the month (1–31)
MONTH The month (1–12)
DOW The day of the week (0–7) where 0 and 7 are Sunday.
To specify multiple values for one field, the following operators are available. In the order of precedence,
To allow periodically scheduled tasks to produce even load on the system, the symbol H (for “hash”) should be used wherever possible.
First weekday of the month rules:
The following cron expressions should do the job:
H 7 1-3 * 1
H 7 1 * 2
H 7 1 * 3
H 7 1 * 4
H 7 1 * 5
# Would last have run at Wednesday, July 1, 2015 7:00:02 AM EEST; would next run at Monday, August 3, 2015 7:00:02 AM EEST.
Beware, because of this article, you can't just use:
H 7 1-3 * 1
H 7 1 * 2-5
The above doesn't work! Instead, the job is run on every weekday, twice on the 1st of the month, and maybe twice on the 2nd and 3rd of the month!
But I was not able to reproduce it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With