Operating System - HP-UX
1833847 Members
2128 Online
110063 Solutions
New Discussion

Sceduling Cron Jobs between certain times

 
SOLVED
Go to solution
Joe Milici
Advisor

Sceduling Cron Jobs between certain times

I would like a specific job to run every 15 minutes, every day between the hours of 5:00am and 10:00pm. Is there a way to enter the hour range in Cron?
6 REPLIES 6
Pete Randall
Outstanding Contributor
Solution

Re: Sceduling Cron Jobs between certain times

Sure:

00,15,30,45 5,6,7,8,9,10 * * *

That ought to do it!


Pete

Pete
Joe Milici
Advisor

Re: Sceduling Cron Jobs between certain times

Thanks. Could I do 5-22?
Patrick Wallek
Honored Contributor

Re: Sceduling Cron Jobs between certain times

Actually it oughta be:

00,15,30,45 5-22 * * * /whatever/command

That will run every 15 minutes from 5:00AM until 22:45 (10:45pm). If you don't want it to run at 10:00PM or after, just change the 22 to a 21 (9:00PM), so it will run last at 9:45PM.
Patrick Wallek
Honored Contributor

Re: Sceduling Cron Jobs between certain times

Note: If you want it to run the last time at 10:00 PM, you could do a couple of entries:

00,15,30,45 5-21 * * * command
00 22 * * * command
Pete Randall
Outstanding Contributor

Re: Sceduling Cron Jobs between certain times

Sorry, Joe, I missed the PM after your 10:00. Patrick's got the answer for you.


Pete

Pete
Joe Milici
Advisor

Re: Sceduling Cron Jobs between certain times

Thanks for your help.