linux – cron and multiple concurrent jobs

Question:

If I put two tasks in cron to be executed at the same time, then how will they be launched for execution (and executed): in parallel or alternately (the second will be executed after the first)?

Answer:

If tasks are described in crontab on different lines, then they will be executed independently of each other, including in parallel, if the time coincides.

If you need two tasks to be performed strictly one after the other, then you can write them on one line, separated by a semicolon:

01 12 * * * mike task1 parameters; task2 parameters; ...

In addition, if by the time of its next start the previous instance of the task has not finished yet, kronor will not check anything and will start the second copy. It is up to the task at hand to keep track of and prevent parallel runs.

Scroll to Top