Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira cron expression - monday to friday

DG March 20, 2023

Hello community,

I was trying a automation during a cron expression 

like:

every 5 minutes, during 17 - 7 from monday to friday 

  0 */5 17-7 * * MON-FRI *

But it looks like the day of week is wrong, I received this error:

"You must use '?' for either the day-of-month or day-of-week."

And it is still the same error, when I try:

  0 */5 17-7 * * 1-5 *

Does anyone have an idea where the error is?

I was using this documentation:

https://support.atlassian.com/jira-software-cloud/docs/construct-cron-expressions-for-a-filter-subscription/

And day-of-week describes:

1-7 or MON-FRI

 

 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2023

Day of month according to that doc page is fourth position, so

 0 */5 17-7 * * 1-5 *

would be

 0 */5 17-7 ? * 1-5

 

Removing last asterisk for the year as it's optional.

 

Edit: Not sure if 17-7 will work, might need to do 17-23,0-7 but no idea if the atlassian scheduler works with it or not, https://crontab.guru/ doesn't seem to like it at least.

DG March 20, 2023

Hi Radek Dostál 

I can save this expression, it looks like it works. 

Is it the same "17-7" from 5pm to 8am?

0 votes
John Funk
Community Champion
March 20, 2023

Hi DG,

Try this:

0 0/5 17,7 * * MON-FRI

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2023

17,7 means "17" and "7", which is different than a time range 17-7.

0/5 should be functionally the same as */5 I believe, it's the same as writing 0-59/5 so it practically is the same without a difference, unless I misunderstood cron.

DG March 20, 2023

@John Funk 

When I try this:

0 0/5 17,7 * * MON-FRI 

I received the same error:

"You must use '?' for either the day-of-month or day-of-week."

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events