[OpenIndiana-discuss] shell script mutex locking or process signaling
Edward Ned Harvey (openindiana)
openindiana at nedharvey.com
Thu May 30 16:58:16 UTC 2013
> From: Aneurin Price [mailto:aneurin.price at gmail.com]
>
> I don't know about pure/POSIX shell, but at least bash and ksh support
> noclobber, which should do the trick. I've been using the following
> idiom for some time without problems:
I read somewhere (possibly obsolete, and also can't relocate) that noclobber on solaris doesn't always work right. And in any event, I don't see the advantage of using noclobber on a file, versus using mkdir. (Mkdir has the advantage of definitely being atomic, regardless of platform.) Either way, you could still have stale locks left around (even with trap), after a "kill -KILL" or a kernel, storage, or power failure.
It would be *really* nice to have a locking mechanism that exists solely in ram, so it would go away and automatically release locks, in the event of a system ungraceful reboot.
More information about the OpenIndiana-discuss
mailing list