On Thu, May 30, 2013 at 04:51:57PM +0000, Edward Ned Harvey (openindiana) wrote: > > From: Gary Mills [mailto:[email protected]] > > > > On Thu, May 30, 2013 at 02:15:12PM +0000, 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 of any kind for any reason, you might do things like > > > enable and disable or refresh the service ... but each time the > > > script gets launched, it's not aware of the previous one. > > > > Are you saying that the method script itself might manipulate the > > service, or that the system admin might do it? SMF has ways to > > prevent multiple instances of the method from running and to make > > enable and disable requests synchronous. Can you do what you want > > within SMF, or does the method script had to do all the process > > manipulation? > > Not familiar with that, but, if you can name some XML tags, or > things to search for, I'd be willing to take a look. I can say > this: I'm biased to believe SMF is complex and confusing, mostly due > to lack of understandable documentation surrounding the XML, and > lack of any good XML tools to edit, validate, or otherwise produce > good XML. So I'm biased to expect it's probably better to use > locking within the script.
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. I'd recommend using the facilities of SMF, rather than trying to do it all outside of SMF. These facilities are extensive and complete. You might consider breaking the system up into a series of services that are linked by dependancies. SMF handles dependancies very nicely. I suspect that virtualbox has requirements that could be separated and made dependancies. That might simplify the whole model. For example, I recently set up a two-node cluster with shared storage and manual failover using SMF. I created a `shepherd' service that only managed the storage and configured the network interface. One ran on each node, but only one came online. All of the failover services had a dependancy on the shepherd service. They waited until that service came online and then ran. This all worked perfectly. > Also, the desired behavior is NOT to prevent multiple scripts from > running. The desired behavior is to let the later instances > supersede the previous instances, letting the previous instances die > gracefully (without putting SMF into mainetnance or anything like > that.) So a certain amount of shell script hackery is required, no > matter what. Have you considered the contract facility? It's used internally by SMF, but you can use it elsewhere as well. The shell commands are ctrun(1), ctstat(1), ctwatch(1), and pkill(1). -- -Gary Mills- -refurb- -Winnipeg, Manitoba, Canada- _______________________________________________ OpenIndiana-discuss mailing list [email protected] http://openindiana.org/mailman/listinfo/openindiana-discuss
