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

2013-06-03 Thread Jim Klimov
On 2013-06-01 02:05, Edward Ned Harvey (openindiana) wrote: Now I wonder how I ever saw multiple concurrent instances of the start method running. Did I really do it manually, by running /lib/svc/... start and not remember that particular detail afterward? Was it a behavior that changed from

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

2013-06-01 Thread Gary Mills
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

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

2013-06-01 Thread Gary Mills
On Sat, Jun 01, 2013 at 02:20:09PM +, Edward Ned Harvey (openindiana) wrote: From: Gary Mills [mailto:gary_mi...@fastmail.fm] 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.

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

2013-05-31 Thread Edward Ned Harvey (openindiana)
From: Laurent Blume [mailto:laurent...@elanor.org] That's why I pointed out mine are in /tmp or /var/run - tmpfs, so it's guaranteed cleared on reboot, graceful or not :-) The behavior of clearing out /tmp is a configurable feature, and the default varies by OS. Some OSes clear it on every

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

2013-05-31 Thread Edward Ned Harvey (openindiana)
From: Gary Mills [mailto:gary_mi...@fastmail.fm] SMF is actually well documented, but you do have to jump around from man page to man page. Start with `man smf'. There are also lots of examples to follow, both of manifests and methods. They are all text files. Ok, so here's a

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

2013-05-31 Thread Laurent Blume
On 31/05/13 13:15, Edward Ned Harvey (openindiana) wrote: I'm not sure what the default is for solaris / openindiana. For the problem at hand (SMF service) obviously, it doesn't matter what the linux defaults are. ;-) Of course I assumed we were compliant with filesystem(4) here ;-) For

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

2013-05-31 Thread Udo Grabowski (IMK)
On 31/05/2013 13:41, Edward Ned Harvey (openindiana) wrote: From: Gary Mills [mailto:gary_mi...@fastmail.fm] SMF is actually well documented, but you do have to jump around from man page to man page. Start with `man smf'. There are also lots of examples to follow, both of manifests and

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

2013-05-31 Thread Udo Grabowski (IMK)
On 31/05/2013 16:44, Udo Grabowski (IMK) wrote: On 31/05/2013 13:41, Edward Ned Harvey (openindiana) wrote: From: Gary Mills [mailto:gary_mi...@fastmail.fm] SMF is actually well documented, but you do have to jump around from man page to man page. Start with `man smf'. There are also lots of

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

2013-05-31 Thread Edward Ned Harvey (openindiana)
From: Udo Grabowski (IMK) [mailto:udo.grabow...@kit.edu] If you don't understand SMF (which is a bit clumsy, but indeed has all what you want), use this little generator, it will do the hard work for you: http://sgpit.com/smf/ That's a pretty cool generator. But apparently, I understand

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

2013-05-31 Thread James Carlson
On 05/31/13 12:36, Edward Ned Harvey (openindiana) wrote: From: Udo Grabowski (IMK) [mailto:udo.grabow...@kit.edu] If you don't understand SMF (which is a bit clumsy, but indeed has all what you want), use this little generator, it will do the hard work for you: http://sgpit.com/smf/

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

2013-05-31 Thread Jim Klimov
On 2013-05-31 13:41, Edward Ned Harvey (openindiana) wrote: If LOCKDIR becomes stale (for example, system power cycled while lock existed) any script that *has* lock guarantees to release it in less than 60 seconds. So if the BREAKLOCK script detects LOCK exists for more than 60 seconds,

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

2013-05-30 Thread Edward Ned Harvey (openindiana)
Here's the problem I'm trying to solve: SMF service is configured to launch things like VirtualBox during startup / shutdown. This startup process can take a long time (10, 20 minutes) so if there's a problem of any kind for any reason, you might do things like enable and disable or refresh

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

2013-05-30 Thread Gary Mills
On Thu, May 30, 2013 at 02:15:12PM +, Edward Ned Harvey (openindiana) wrote: Here's the problem I'm trying to solve: SMF service is configured to launch things like VirtualBox during startup / shutdown. This startup process can take a long time (10, 20 minutes) so if there's a problem

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

2013-05-30 Thread Laurent Blume
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

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

2013-05-30 Thread Aneurin Price
On 30 May 2013 15:29, Laurent Blume laurent...@elanor.org wrote: 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

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

2013-05-30 Thread Edward Ned Harvey (openindiana)
From: Gary Mills [mailto:gary_mi...@fastmail.fm] On Thu, May 30, 2013 at 02:15:12PM +, Edward Ned Harvey (openindiana) wrote: Here's the problem I'm trying to solve: SMF service is configured to launch things like VirtualBox during startup / shutdown. This startup process can

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

2013-05-30 Thread Edward Ned Harvey (openindiana)
From: Aneurin Price [mailto:aneurin.pr...@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)

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

2013-05-30 Thread Laurent Blume
On 30/05/13 18:58, Edward Ned Harvey (openindiana) wrote: 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. That's why I pointed out mine are in /tmp or /var/run -

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

2013-05-30 Thread Bob Friesenhahn
On Thu, 30 May 2013, Edward Ned Harvey (openindiana) wrote: I'm looking around, and not finding any great answers. So far, using mkdir, it's easy to see there exists a way to do mutex locking, and you could easily write your PID into the subdir that was just created; unfortunately, the

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

2013-05-30 Thread Tim Mooney
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

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

2013-05-30 Thread Gary Mills
On Thu, May 30, 2013 at 04:51:57PM +, Edward Ned Harvey (openindiana) wrote: From: Gary Mills [mailto:gary_mi...@fastmail.fm] On Thu, May 30, 2013 at 02:15:12PM +, Edward Ned Harvey (openindiana) wrote: Here's the problem I'm trying to solve: SMF service is configured to

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

2013-05-30 Thread Jim Klimov
On 2013-05-30 16:15, Edward Ned Harvey (openindiana) wrote: This problem has two parts. Atomicity of signaling operations (acquiring / releasing mutex, etc), and inter-process signaling. (Let the later instance signal the earlier instance that it should die.) It seems easy enough, as long