1826452 Members
4063 Online
109692 Solutions
New Discussion

Cron Job

 
SOLVED
Go to solution
Joyce Suganthy
Advisor

Cron Job

Hi All,

Need a favour,

How do i put in crontab if i want a job to run every two hours between 8.30 to 5.30 every monday to friday?

Thanks a lot

Regards
3 REPLIES 3
Stefan Farrelly
Honored Contributor
Solution

Re: Cron Job

No easy way, youre going to need an entry such as;

30 08,10,12,14,16 * * 1-5

4:30pm will be the last run as if you add 2 hours to that its 6:30pm which is past your 5:30pm deadline.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Robert-Jan Goossens
Honored Contributor

Re: Cron Job

Hi,

30 5,7,9,11,13,15,17 * * 1-5 command

Regards,

Robert-Jan.
Will Couillard
Occasional Advisor

Re: Cron Job

Add the following entry to cron:

30 08 * * 1-5 program

program contents:

until [[ $(date '+%H%M') = 1730 ]]
do
job
sleep 7200
done