[NBLUG/talk] Mutual exclusion in shell scripts?
Lincoln Peters
sampln at sbcglobal.net
Sat Jan 20 18:00:42 PST 2007
On Saturday 20 January 2007 16:23, Eric Eisenhart wrote:
> 1) procmail comes with "lockfile" that's designed to do what you want.
Except I'm trying to use this as a manual filter in KMail.
>
> 2) check for lock and create at once using a single atomic file operation:
>
> while ! ln -s $$ /tmp/filter.lock 2> /dev/null
> do
> sleep 10
> done
> sa-learn $1 --no-sync
> rm -f /tmp/filter.lock
At first it looks more like an exercise in obfuscated code than anything else,
but I think I see why this would work. I'll try it.
--
Lincoln Peters <sampln at sbcglobal.net>
Now there's three things you can do in a baseball game: you can win
or you can lose or it can rain.
-- Casey Stengel
More information about the talk
mailing list