Ask cron to wait for the job to finish before restarting

I have a cronjob that runs every second minute, which usually runs in seconds, but sometimes within a few minutes.

I need cron to not execute the command if it is already running when the next minute arrives.

The line looks like this: * / 1 * * * * cmd

I tried with this * * * * * ID = job1 FREQ = 1m AFTER = job1 cmd

but without success.

Can I resolve with cron or block?

+3
source share
2 answers

You can create a temporary file called inProgress (or something else) and save it in a standard place and use it to communicate with the next task if it should work or not.

, :

  • inProgress
  • ,
  • Else, inProgress
  • inProgress.
+5

- , , Cron The Fat Controller, .

, x , script .

, Fat script, , , script, , , , . .

- :

http://www.4pmp.com/fatcontroller/

+2

Source: https://habr.com/ru/post/1763482/


All Articles