I have 2 cron jobs, i want one of them to run every odd minute (1,3,5,7,9,11....57,59) and i want the other one to run every even minute (0,2,4,6,8,10,12...58)

how can i do it in an easy way? (no scripting - just cron job rules)

link|improve this question
feedback

2 Answers

*/2 * * * * date >>/tmp/even
1-59/2 * * * * date >>/tmp/odd
link|improve this answer
perfecto! thank you jj33 – wabbajay Jan 7 '11 at 21:37
whoops! i bet you supplied the correct syntax for the "1-59/2" part... can i ask why when i enter this in cpanel it doesnt work? It says "Cron field not formatted correctly..." – wabbajay Jan 7 '11 at 21:43
I don't use cpanel, but I'm going to go out on a limb and suggest that the filter they have placed between you and the actual crontab doesn't see it as valid. It really is though, I typed that exactly into my crontab on a CentOS5 server and got the even minutes in in /tmp/even and odd minutes in /tmp/odd. Sorry cpanel's filtering it... – jj33 Jan 7 '11 at 21:46
thats what i suspected too... i ll set it manually... thank you for your help jj33 :) – wabbajay Jan 7 '11 at 21:53
feedback
*/2 * * * * /path/to/foo
*/2 * * * * sleep 60; /path/to/bar

Is that that sleep 60 too much like a script?

link|improve this answer
yes its more like a script and for sure it is not "just cron job rules". thank you for your time anyway ;) – wabbajay Jan 7 '11 at 21:39
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.