Multiple cronjobs at the same time
10,846
Yes, cronjobs can run at the same time, and will do so if you set them up that way.
A 1 minute gap between each of the jobs might work, but what if one of them takes longer than a minute to run?
I would recommend explicitly calling them all in order:
0 * * * * joba.sh && jobb.sh && jobc.sh && jobd.sh
Note that this has the additional advantage of only calling the next job in the sequence if the previous one finished successfully.
Author by
firepro20
Updated on August 05, 2022Comments
-
firepro20 over 1 year
What happens if I task the machine to run 4 cronjobs at the same time period say
0 * * * * joba.sh 0 * * * * jobb.sh 0 * * * * jobc.sh 0 * * * * jobd.sh
Will they be run one after each other independent of time itself or execute all at that point in time? These 4 jobs consequently in my case depend on each other so I was thinking of giving them a 1min between each of them i.e 0 1 2 3.
What do you think?
-
firepro20 almost 8 yearsExcellent just what I require. Thankyou!
-
AMS about 4 yearsFor completion, if you don't care about the preceding job failing, syntax is: 0 * * * * joba.sh ; jobb.sh ; jobc.sh ; jobd.sh
-
Shadow about 3 yearswhy we don't use cron at the same time.. ?