Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Interval CRON expression with specific start and stop times

Dani Sill I'm New Here Jul 01, 2021

I currently have the CRON expression for an automation that runs every two hours as follows:

0 0 0/2 ? * MON-FRI

However, due to the time zone distribution of my team, we'd like to tighten the period of this automation to exclude time around the weekend. I understand that the expression as written currently will start at 12:00am (midnight) UTC on Monday and last run will be around 10:00pm UTC on Friday. I'd like to modify it so that it insteads starts at 8am on Monday and then runs continuously every two hours until 6pm on Friday. Is this possible to do in a single expression?


In the worst case I think I'd split it into three expressions: one for Monday to start late, one for Tuesday through Thursday continuously, and one for Friday to end early, though this is less than ideal since it would result in extra work any time we would need to make changes in the future.

1 answer

0 votes

Hello @Dani Sill,

Welcome to the Atlassian Community!

Thank you for sharing the details.

Checking the documentation and also some websites that help with building CRON expressions, I believe that the one that fits your requirements would be:

0 0 8,10,12,14,16,18 ? * MON-FRI *

I used this one and here are the results of the next execution dates:

Screen Shot 2021-07-05 at 12.21.19.png

Please, take your time to test and let us know how it goes.

Kind regards,

Dani Sill I'm New Here Jul 06, 2021

Hi Angélica,

Your example would miss times that I would want the job to run, for example, I would want these times that are missing from your screenshot:

Mon Jul 05 20:00:00 UTC 2021

Mon Jul 05 22:00:00 UTC 2021

Tue Jul 06 00:00:00 UTC 2021

Tue Jul 06 02:00:00 UTC 2021

Tue Jul 06 04:00:00 UTC 2021

Tue Jul 06 06:00:00 UTC 2021

Hi Dani,

I’m sorry for the misunderstanding, I thought you needed the automation to run from 8 am to 6 pm every day.

We checked here and found out that it’s not possible to do what you need with only one rule, it will be necessary to use three.

The first one will work for Mondays, it will start at 08:00 and end at 22:00: 

0 0 8/2 ? * MON *

The second one will start at midnight (Tuesday) and it will end at 22:00 on Thursday:

0 0 0/2 ? * TUE,WED,THU *

The last one will start at midnight (Friday) and end at 18:00 on Friday as well:

0 0 0-18/2 ? * FRI *

Hope this helps!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

109 views 1 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you