[Gllug] Cron?
David Damerell
damerell at chiark.greenend.org.uk
Thu Oct 24 11:15:20 UTC 2002
On Thursday, 24 Oct 2002, Neil Fryer wrote:
>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?
These are not necessarily compatible, if it might take more than 2
minutes. :-)
You could have it write a PID-file (say, /var/run/mytask with the PID
of the process in) which it deletes on completion. If at startup it
finds such a file, it can either just stop and complain or possibly
check to see if the relevant process is still running (in case it's
died without removing the file.)
Since it's only started once every 2 minutes, you don't have the usual
locking worries - normally with something like this you have to be
careful that 2 copies don't both check the file doesn't exist and then
both create it.
--
David Damerell <damerell at chiark.greenend.org.uk> flcl?
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list