[Gllug] Single instance of a process - simple way

Ziya Suzen ziya at suzen.net
Fri Jul 6 11:57:46 UTC 2007


On 7/6/07, Fred Youhanaie <fly at anydata.co.uk> wrote:
> Progga wrote:
> > $ man lockfile (it exists at least in Debian:)
>
> It's part of procmail, at least on my Ubuntu 7.04.

Thanks very much for the replies.

I ended up using with-lock-ex utility in my cronjob:

*/15 * * * * with-lock-ex -f /var/run/rsync.opt.lock  rsync -az
my.host:/opt/  /backup/myhost/opt/

That's it, simple and reliable. Just the way I like it :) I suppose I
could have used lockfile and that would have been simple too. And I
admit in critical jobs you would want it to cover more exceptions more
conveniently, but I think this probably covers the majority of the
cases.

with-lock-ex is very similar to lockf (the utility, not the libc
function) on FreeBSD. Only if it had the timeouts, it would have been
perfect. Maybe I'll bother the author (Ian Jackson), if he is still
interested.

-z
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list