[Gllug] Cron?

Mark Lowes hamster at korenwolf.net
Thu Oct 24 11:14:57 UTC 2002


On Thu, 2002-10-24 at 12:08, Paul Roberts wrote:
> Neil Fryer <neil.fryer at 12snap.com> 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?
> 
> You could make the script that performs your task create a temporary
> file when it starts, then delete it when its finished.
> 
> Then, at the beginning of the script, you could just loop while that
> file exists.

A slightly more elegant version would have the script store it's own pid
and cmdline information in the file, so the next instance on finding
that file can check to see if the process is still running.  Removing
the lockfile if it isn't and exiting graceful if it is.

-- 
The Flying Hamster <hamster at korenwolf.net>     
http://www.korenwolf.net/
RTFM? 
I am reading the Karma Sutra...

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




More information about the GLLUG mailing list