cron job to run for last few days of month (possibly into next)

0

I'm trying to setup a cron job that will run from the 29th, for 4 days each quarter (Jan/Apr/Jul/Oct).

I've setup the following…

*/10 6-17 29-31 1,4,7,10 1-5 php script.php
*/10 6-17 1 5 1-5 php script.php

I just wanted to check that the */10 6-17 29-31 1,4,7,10 1-5 php script.php line wouldn't make things break in April, would it, as there is no 31st in April.

TobyG

Posted 2015-04-30T12:08:16.323

Reputation: 143

Answers

0

IMHO this line will run each working day:

*/10 6-17 29-31 1,4,7,10 1-5 php script.php

The reason is days of week are related to rest of the definitions (minutes, hours, days, months) with function OR. The definitions minutes, hours, days, months are binded by AND funtion

P.S. So my proposal is to incorporate this login in the script itself

Romeo Ninov

Posted 2015-04-30T12:08:16.323

Reputation: 2 062

Do you mean that the days of the week are ORed with the date fields? I'm assuming the time fields will be relevant to both date & days of the week fields? – TobyG – 2015-05-01T18:47:47.370

Yes, all except day of week are ANDed and the result is ORed to day of week – Romeo Ninov – 2015-05-01T20:05:46.727