[OpenIndiana-discuss] shell script mutex locking or process signaling

Tim Mooney Tim.Mooney at ndsu.edu
Thu May 30 18:17:11 UTC 2013


In regard to: Re: [OpenIndiana-discuss] shell script mutex locking or...:

> On 30/05/13 16:15, Edward Ned Harvey (openindiana) wrote:
> <snip>
>> I see there are a bunch of C constructs available ... mutex_init,
>> etc.  Surely there must be a wrapper application around this kind of
>> thing, right?
>
> I spent some time looking for a lock in shell some time ago. The overall 
> conclusion was that the only atomic operation in pure shell is mkdir.
>
> I use /tmp or /var/run so it's at least deleted on reboot, and my
> scripts trap signals so when it ends (either correctly or after being
> interrupted),

In my experience, mkdir is also the easiest reliable mechanism.

It's perhaps unfortunate that there's an ipcs and an ipcrm, but no
ipcmk.  That would be the logical way to do what the original poster
is asking about.

Tim
-- 
Tim Mooney                                             Tim.Mooney at ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164



More information about the OpenIndiana-discuss mailing list