Bob Netherton wrote: > O > >>> If his stop method succeeds, SMF sees (through the contract) that he >>> lied, and kills his daemon off anyway. >>> If his stop method fails, SMF whines about it. >>> If his stop method doesn't return (and assuming that he's disabled >>> timeout), then it blocks the shutdown. >>> >> Correct. >> > > Why not make the stop method a little more intelligent so that it > doesn't block forever ? Maybe the event daemon (or whatever > the troublesome process) needs to run in a separate contract to > decouple it a bit from SMF, but a little more massaging of the > stop method might be the ticket. > Thanks Bob!
I got a reply last night suggesting something similar. As I understand it, what I need to do is copy some code from ctrun, to make make a middle-man daemon that creates and executes a separate contract (where the real daemon runs). Most of the time, the middle man daemon will pass signals on to the real daemon, and wait for the real daemon to die. (if the real daemon dies, the middle man will exit, so SMF will restart things) In the special shutdown case where the real daemon should not die, the middle man will send the "shutdown when your filesystems are gone" signal then exit. That would make SMF happy (the daemon it knows about is gone), and the real daemon would be permitted to hang around as long as it needs to.