Forums

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

Help with Cron Expression for filter subscription

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 13, 2023

We have a filter subscription to be enabled which should run on particular time.

notification should start on every saturday morning 6.30 am and should end on monday morning 6.30 am . so it should run from saturday 6.30 am to saturday,sunday and Monday till morning 6.30am for every 5 minutes .

 

I'm not able to find a cron expression for this online . please help

1 answer

0 votes
Sriram Kancharla August 14, 2023

*/5 6-23 * * 6-1

Let's break down the expression:

  • */5: This means "every 5 minutes."
  • 6-23: This specifies the range of hours from 6 (6:00 AM) to 23 (11:00 PM).
  • *: This field is for the day of the month and is left as wildcard (*) to match any day.
  • *: This field is for the month and is also left as wildcard (*) to match any month.
  • 6-1: This specifies the range of days of the week from 6 (Saturday) to 1 (Monday).

This cron expression will run every 5 minutes from 6:30 AM on Saturday until 6:30 AM on Monday, following the schedule you described.

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 14, 2023

when i entered this i'm getting unexpected end of expression error

Kseniia Trushnikova
Community Champion
August 14, 2023

@CHINNAMUTHEVISAI.SATYANARAYANASHARMA, try this:

0 */5 6-23 ? * 6-1

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 14, 2023

Hi,

After i did this , its showing next run would be in 4 days . that means it should be friday right ? but i want to run it from saturday 6.30 am to Monday 6.30am

Kseniia Trushnikova
Community Champion
August 14, 2023

@CHINNAMUTHEVISAI.SATYANARAYANASHARMA, oh, indeed 6 is Friday.

Try 0 */5 6-23 ? * 7-2 or 0 */5 6-23 ? * SAT-MON

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 14, 2023

Thanks for this ,

But in my time zone its 5.10 pm as per cron it should run untill Monday morning 6.30 am only . but its running on entire Monday also 

Kseniia Trushnikova
Community Champion
August 14, 2023

@CHINNAMUTHEVISAI.SATYANARAYANASHARMA, I'm not sure that it's possible to send email every 5 minute from 6:30. In the cron we define minutes by */5 that literally translates to every 5 minutes. I don't think that we can use / that specifies increments to the given value with other symbols. See more info here: https://support.atlassian.com/jira-software-cloud/docs/manage-filters/

As @Sriram Kancharla said this cron specifies the range of hours from 6:00 to 23:00.

Try this cron to run from 6:00 to 6:00: 0 */5 6-6 ? * SAT-MON

This cron is quite complex, please check if it works as expected.

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 14, 2023

i tried this , but its saying next run on 3.30PM .

our time zone of instance is different , so i think it wont work as the requirement .

i'm attaching my instance time zone and filter sub scription, please find and let me know if any changes need to be done .

Capture.PNGCapture1.PNG

Kseniia Trushnikova
Community Champion
August 14, 2023

@CHINNAMUTHEVISAI.SATYANARAYANASHARMA, update hours according to the system time then:

0 */5 22-22 ? * FRI-SUN

The system time is used for subscriptions.

CHINNAMUTHEVISAI.SATYANARAYANASHARMA
Contributor
August 16, 2023

Thanks Kseniia ,

I have updated this accordingly . I'm just waiting for this Saturday to run this and will let you know if there is anything needed here . Thanks alot for your support

Kseniia Trushnikova
Community Champion
September 6, 2023

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events