Crontab schedule

Hi all,

I would like to schedule a crontab script, which should run From 8pm Thursday to 2am Friday and it should run every 10 minutes. I have put a script like below, is it the correct one.

10 01,02,20,21,22,23,00 * * 4-5 /u01/app/test.ksh 

Any other options available to schedule the same interval.

It looks almost correct. Except you're running it only 10 minutes past the hour, not every 10 minutes.

You can also shorten it slightly, if you wished:

*/10 00-02,20-23 * * 4,5

Or, if */10 is not supported:

0,10,20,30,40,50 00-02,20-23 * * 4,5
1 Like

Scott,

Thanks much and appreciate for your quick reply.

If we use this code,

*/10 00-02,20-23 * * 4,5

then it will run on 12am - 2 am and 8pm - 12 am on Thursday and Friday.

But my requirement is slightly different, job should run from 8pm thursday until 2 am friday.

Please let me know.

Sorry, yes, I overlooked that!

You would need two jobs, or handle it within your script:

*/10 20-23 * * 4
*/10 00-02 * * 5

Thanks much scott :smiley:

You can use the interactive cron trainer at http://www.dataphyx.com to play with crontab timing values. Put in any combination of time/date values and get back a list of future run-times.

2 Likes

If 02:10 to 02:50 is okay, this is correct.

*/10 00-02 * * 5

But I do read "to 2am", it should be

*/10 00-01 * * 5

@mlbox01
Thanks for the site Cron Buddy. A crontab sandbox.