Forums

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

Need help of cron

DINESH January 10, 2022

I need cron expression for below

one time per quarter. first week of month(working days)

1 answer

0 votes
Dirk Ronsmans
Community Champion
January 10, 2022

Hey @DINESH ,

You can use the below site to create a CRON expression.

https://www.freeformatter.com/cron-expression-generator-quartz.html

This one allows you to click/select what you need and it will provide you with the correct CRON expression.

DINESH January 10, 2022

Hi Ronsmans

I tried multiple ways to find in cron tab but no luck I need exact cron expression  for my rewuirement

Dirk Ronsmans
Community Champion
January 10, 2022

You could try with thisone:

0 0 0 1W 1/3 ? *

That means

At 00:00:00am, on the nearest weekday to the 1st of the month, every 3 months starting in January

As there isn't a "Quarterly" one you can do "every 3 months starting in january.

Nearest weekday ot the 1st of the month also seems good for me.

For example this would trigger on:

  • Fri Apr 01 00:00:00 UTC 2022
  • Fri Jul 01 00:00:00 UTC 2022
  • Mon Oct 03 00:00:00 UTC 2022
  • Mon Jan 02 00:00:00 UTC 2023
  • Mon Apr 03 00:00:00 UTC 2023
  • Mon Jul 03 00:00:00 UTC 2023
  • Mon Oct 02 00:00:00 UTC 2023
  • Mon Jan 01 00:00:00 UTC 2024
  • Mon Apr 01 00:00:00 UTC 2024
  • Mon Jul 01 00:00:00 UTC 2024
DINESH January 10, 2022

Hi Ronsmans I tried this also as per this results is 1st of the month but i want 1st week working days and i am strucking here 

Dirk Ronsmans
Community Champion
January 10, 2022

Well no it's not the first of the month.

This expression will give you the first weekday closest to the first day of the month.

Do you need all working days for the first week?

You might need to split it up then for each day:

0 0 0 ? JAN,APR,JUL,OCT 2#1 * 

At 00:00:00am, on the 1st Monday of the month, in January, April, July and October

 

0 0 0 ? JAN,APR,JUL,OCT 3#1 *

At 00:00:00am, on the 1st Tuesday of the month, in January, April, July and October

 

0 0 0 ? JAN,APR,JUL,OCT 4#1 *

At 00:00:00am, on the 1st Wednesday of the month, in January, April, July and October

 

0 0 0 ? JAN,APR,JUL,OCT 5#1 *

At 00:00:00am, on the 1st Thursday of the month, in January, April, July and October

 

0 0 0 ? JAN,APR,JUL,OCT 6#1 *

At 00:00:00am, on the 1st Friday of the month, in January, April, July and October

 

Not sure if you can combine it in to a single one if it has to be only the first week.

DINESH January 10, 2022

I need cron expression for all working days in the first week. I tried above expression but my client never accepted that, they want exact expression 

Dirk Ronsmans
Community Champion
January 10, 2022

Then I fear that I can't help you further, these are working expressions but you need to split it up for each weekday.

DINESH January 10, 2022

Ok Ronsmans,

 

Anyways thank you very much for reply

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events