[Gllug] Cron?

Tethys tet at accucard.com
Thu Oct 24 11:09:20 UTC 2002


Neil Fryer writes:

>If I want to run a task every 2 minutes, how can I make sure that the same
>task run previously finishes before the next one starts?

Locking. Write a wrapper script that starts the job in the background, and
writes the PID to a file. At the start of the script, read the PID file,
and send signal 0 to that PID. If it returns 0, the process is still
running, so bail out. If not, the process has completed, so run the job
as normal.

Tet

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list