0

I would like to run cron job A every 3 minutes, and cron job B every 5 minutes. But I would like job A to always run 3 minutes before job B.

How would I accomplish this?

Gaia
  • 1,777
  • 4
  • 32
  • 58
  • 1
    ?? - job A0 run at 0h12, job B0 would run at 0h15, but then job A1 would run also. – Archemar Feb 21 '18 at 06:25
  • 2
    Is this a trick question? – Michael Hampton Feb 21 '18 at 07:50
  • @MichaelHampton I wish I had to the time for that... – Gaia Feb 21 '18 at 14:46
  • @Archemar, right, hence the need to sync them. – Gaia Feb 21 '18 at 16:11
  • I asked a more specific question, but my challenge is to make job A run before job B. i can't put the two together because B needs to finish in less than 30 seconds, and A takes a little over a min to finish – Gaia Feb 21 '18 at 16:12
  • what about `jobA ; jobB` with a semicolon ? – Archemar Feb 21 '18 at 16:45
  • 1
    You might want to take look at some of the mechanism's I use to deal with [irregular cron schedules](https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it/815541#815541) - let both A & B use the same `flock` and you prevent running the batches concurrently. Record the last successful run of A and don't start B until the minimum interval has passed. – HBruijn Mar 15 '18 at 14:31

0 Answers0