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?
Technically it's possible to run both imports at the same time via cron jobs, but it's not recommended – actively running imports are resource-intensive and could cause your server to struggle.
1. According to our Acceptable Use Policy, running cron jobs with intervals of less than 5 minutes or setting up more than 5 simultaneous cron jobs is not allowed on all shared servers. 2. If you do not add >/dev/null 2>&1 at the end of the command, the server will send an email notification each time a cron job runs.
It's common that root can have multiple crontab files under /etc/cron. d/ . It's useful if you have a bundle of crontab entries that you want to maintain across multiple servers, and you don't know what changes might be made to the regular crontab.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With