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

Edward Ned Harvey (openindiana) openindiana at nedharvey.com
Sat Jun 1 14:20:09 UTC 2013


> From: Gary Mills [mailto:gary_mills at fastmail.fm]
> 
> On Fri, May 31, 2013 at 01:52:01PM -0400, James Carlson wrote:
> >
> > Are your methods returning before the action they're supposed to take is
> > completely finished?  If so, then that sounds like the underlying
> > problem to me.  The methods are not supposed to exit until they're done
> > doing whatever it is they do.  If they do, then the design of that
> > service is incomplete.
> 
> That requirement is described briefly in the smf_method man page:
> 
>      The required behavior of a start method is to delay  exiting
>      until the service instance is ready to answer requests or is
>      otherwise functional.
> 
> If your method script starts a server process in the background and
> then immediately exits, it is broken.

Fortunately for me, I don't have that problem.  The start & stop scripts do indeed stay running until the service has reached a running or stopped state.  The issue is with regard to concurrency - if a service takes a long time to start or stop, or if there's a problem with the start or stop, then the ability to launch "stop" and have it kill a "start" that's already in progress.  I swear, I've seen multiple instances of the script running concurrently before, but now I can't reproduce that.  At least, it can be run multiple times in parallel - manually.  If the admin issues "stop" while the "start" is still in progress (now that I've added this locking etc) then the start script dies gracefully, and the stop script does its thing.



More information about the OpenIndiana-discuss mailing list