[Gllug] Single instance of a process - simple way

Ziya Suzen zsuzen at acm.org
Thu Jul 5 19:02:00 UTC 2007


On 7/5/07, Richard Jones <rich at annexia.org> wrote:
[..]
> Perl, python and so on all have access to the POSIX locking API
> (lockf(2) as mentioned by the other reply), so perhaps you can write a
> trivial little wrapper around your script which grabs an exclusive
> lock on a file under $HOME when the script runs, and releases it when
> the script exits.
>

I think that was referring to lockf(1)
http://www.freebsd.org/cgi/man.cgi?query=lockf&sektion=1

However simple it might be I wanted to avoid maintaining a script. And
I though it must be one of those problems everyone faces every day and
there must be some utility out there.

> I'll share a war story with you about this, but first some general
I have one too :)

> didn't particularly help that $HOME in that case was mounted on NFS,
> and locking on NFS is very shoddy).  So occasionally we'd find out
We had a similar setup, only worst, we had other application specific
stuff on NFS shares as well!

Our issue was with an in-house developed some kind of core
application. We installed the application, started the daemon, put the
rc scripts, tested them and everything, but we never tried to reboot
the box since it was a 24/7 server. We were all happy until one day
there was a hardware maintenance on the box and it had to be rebooted.
Once it rebooted nothing seemed to work, since quite a few other
services relied on this application. But It took us quite a while
until we discover the reason was this core application (which did not
start). We were so confident it would not fail at all! The main reason
turned out to be a combination of nfs automounts and placing some
critical file on these mounts.

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




More information about the GLLUG mailing list