How to set the cron expression twice a day?

Hello,

Can someone help me how to set the cron expression for twice a day? I want the process to run specifically at 4:45 & 5:00AM everyday?

@i-hsin.wang
have a look here:

so you are tool supported by defining cron expressions

Use these cron expressions:

0 45 4 ? * ? * and
0 0 5 ? * ? *.

See this documentation for more.

Does this mean I need to have 2 schedules? Or can I put both expressions in one schedule?

You’ll need 2. Unless you have an iterative schedule (run every n minutes/hours/days/etc), you’ll need multiple schedules.

1 Like

Thank you!! That answers my question!!

1 Like

@i-hsin.wang
@Anthony_Humphries
Well that’s lil tricky…
At second :00, every 15 minutes starting at minute :45, every hour between 04am and 05am, of every day

0 45/15 4-5 ? * * *

This will do exactly two runs

But wouldn’t that run at 4:45 AM, 5:00 AM, and 5:45 AM?

2 Likes

@Anthony_Humphries

I think so :stuck_out_tongue:

Well if i go by logic, it should only run between 4-5 AM starting 45 minute of an hour in every 15 minutes.

> I might be totally wrong in this

Well you were right @Anthony_Humphries
@i-hsin.wang
I have to do a bit of modification…

0 45/14 4-4 ? * * *

Every 14 minutes, starting at 45 minutes past the hour, between 4:00 AM and 4:59 AM

I don’t know how useful it would be.

This is interesting. I will give it a try! Thank you very much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.