13 Apr
2001
13 Apr
'01
5:41 p.m.
On Thu, Apr 12, 2001 at 12:37:34AM -0500, Aaron Schrab wrote:
At 11:58 -0400 11 Apr 2001, Charlie Summers <charlie@lofcom.com> wrote:
touch rc.lock; rm accept; ln dist accept; rm rc.lock
Using touch(1) to create the lockfile isn't a good idea. If the lockfile doesn't currently exist it will be fine, but if it's already there (and it could be created between the time ls is run and the time touch is run) touch won't complain at all.
Instead you should use the lockfile command (part of the procmail package, so it will exist on any system using SmartList):
lockfile rc.lock && rm accept && ln dist accept && rm rc.lock
Or side-step the whole issue with an atomic operation: ln -f dist accept I mean, sheesh.