Click here to Skip to main content
15,886,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not sure how to run a cron job at 3 specific hours every day. I want to run it at 8:30 AM, 5:30 PM and 11:30 PM

Ideas how that might work? Is it possible at all in one expression?
Posted
Updated 12-Jun-14 19:07pm
v2
Comments
DamithSL 13-Jun-14 1:26am    
Are you using any library or external tool for scheduling?
saumil.sapariya 13-Jun-14 2:48am    
I am currently using Quartz.dll for scheduling.

No, there is no math (at least no simple one I can think of) allowing to go from 8:30 AM to 5:30 PM then 11:30 PM.
But nothing prevents you from entering three entries in your cron table.
 
Share this answer
 
30 5,8,11 * * * my-command
This means hours 5, 8 and 11 at minute 30.

A problem would be if you wanna 5:00, 8:30 and 11:00...
CRON does not handle options but you can do it from your file if you run the comand each minute 0 and 30, so you can handle these 2 points of start.

It's so easier to split tasks and harder to create rules based on time.
 
Share this answer
 
0 30 8,17,23 ? * * *
^ should work. This is saying: At second :00, at minute :30, at 08am, 17pm and 23pm, of every day.

Give it a try.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900