14

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
  • 371
  • 2
  • 3
  • 14

1 Answers1

27

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.

Hamms
  • 5,016
  • 21
  • 28