Just noting that I was bitten by the locking bug too, which I solved thusly:

TLOCK="$(mktemp -p /var/lock)"
LOCK="/var/lock/ifupdown-mountnfs"
if ln "$TLOCK "$LOCK" 2>/dev/null; then
        do_start
        rm -f "$LOCK"
fi
rm -f "$TLOCK"

(Here's another variant with one file less, but I'm not sure if it's as atomic as the above. In this case either works, I think.)

LOCK="/var/lock/ifupdown-mountnfs"
if ln -s - "$LOCK" 2>/dev/null; then
        do_start
        rm -f "$LOCK"
fi


I think using /var/lock for its intended purpose might be a nice idea. It's also automatically cleaned by /etc/init.d/bootclean - but it specifically doesn't remove directories from neither /var/lock nor /var/run, which is the problem you run into when the script is interrupted for various reasons. So please don't use mkdir for locking.

-Samuel


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to