[CentOS] Any one have a good example...

mike.redan at bell.ca mike.redan at bell.ca
Tue Aug 29 19:51:18 UTC 2006


>
As long as you don't have multiple scripts starting at approximately
the same time.   I use this same algorithm sometimes but I always use
flock() because otherwise there is a race condition.  Even using
flock() does not remove the race on the creation of the file, though,
which is why if you really want to remove the race condition you make
sure the file pre-existant (via package delivery or something to that
affect).

At least this is how I understand the problem....james
_______________________________________________


Yep. Defintely. If multiple scripts start up at the same time, then that
pid file will get smashed with multiple values. This works nicely if you
are just looking to make a long running script a little more polite.

Mike



More information about the CentOS mailing list