Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to run a Cron job for every 5 mins for only 30 mins?

I want to run a Cron job for every 5 mins for 30 mins, starting at 22:30 till 23:00.

To do this I wrote it like this

0 30,0/5 22 ? * * *

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you put this in https://crontab.cronhub.io/

It will say:

At 30 minutes past the hour and every 5 minutes, starting every hour, between 10:00 PM and 10:59 PM

But when I looked at the logs, I see it started the run at 22:00 till 22:55.

Why is this happening? Also, how can I make it work like the way I want it to.

>Solution :

To run a Cron job every 5 minutes for 30 minutes, starting at 22:30 till 23:00, you can use the following syntax:

30-59/5 22 * * *
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading