0

I have a set of 6 jobs to be run via cron. Let's call them jobs A,B,C,D,E & F 'A' & 'B' take 2 mins to complete, 'C' , 'D' , 'E' & 'F' take 3 min each to complete. No job is dependent on the other

The problem of running them all together is a burst of CPU & then everything is idle. I'm looking to space the execution of these jobs apart such that the jobs don't lock up the resources & produce erroneous results which is to say I would like to not have these jobs overlap with any other

I'm finding it quite hard to work out the schedule to run these.

2
  • 7
    Why not just write script ''Z'' that calls all the others consecutively?
    – Scott
    Apr 28 '19 at 4:56
  • I use run-parts dir where dit hold all you scripts. you can add sleeping script between them to allow for CPU/load average to cool down.
    – Archemar
    Apr 28 '19 at 7:05
1

As user Archemar already pointed out in his comment use the utility run-parts.

In many Linux distributions this is also used to execute all the cron scripts of severaly system software packages stored in the directories /etc/cron.daily, /etc/cron.hourly and so on. Normally run-parts will execute all your scripts one after the other in sequence. Beware of the naming conventions: run-parts will normally not execute any script files which contain a period in the filename.

1
  • Thanks a lot Pefu. I totally forgot about this until I bumped on my own question now for the same problem. lol
    – usert4jju7
    Nov 17 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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