in investigating a problem with a system() initiated execution of "pkill -9 dhcpagent" that we require as part of our shutdown procedure in the nwam daemon, it occurred to me that we could use process contract information to do a cleaner sigsend() to all the members in the contract (see http://blogs.sun.com/lianep/entry/how_does_kill_work). This would have the added benefit that it would kill any ENM scripts that were still running (as we spawn those also). Is there a reason not to pursue that approach perhaps? Thanks!
Alan Michael Hunter wrote: > On Thu, 26 Mar 2009 17:36:19 +0000 > Alan Maguire <Alan.Maguire at Sun.COM> wrote: > > >> Michael Hunter wrote: >> >>> Can you gather more data on the pkill failing? It seems to work for me. >>> >>> mph >>> >>> >> haven't had a chance to do much gathering yet as the >> system is pretty flaky right now, but poking about in the code >> it occurred to me on stop, net-nwam could use the >> contract kill function in /lib/svc/share/smf-include.sh, i.e. >> replacing >> > > I talked with Renee about this a bit last night and there was a reason > some of this stuff works as it does. I'm pulling a blank at the > moment. I intended for this conversation to happen on nwam-dev but I > got the address wrong. Want to move over there and see what she has to > say. I'll look over the rest of this later after I get some code done. > > mph > > >> "/usr/bin/pkill -z `smf_zonename` nwamd" >> >> with >> >> "smf_kill_contract nwamd TERM" >> >> The latter will nuke everything in the contract, including >> dhcpagent. Even better, if we can map easily from nwamd's pid to the >> contract id (I'll look into this) within nwamd, we could instead >> do: >> >> "sigsend(P_CTID, ctid, TERM)" >> >> within nwamd (though we should probably do it >> in response to the SHUTDOWN event as opposed >> to recursively in signal handling context. This would >> avoid having to use system() or start_child() in >> the signal handling context. >> >> One thing I was wondering though - what do we do >> about the "pkill -9 nwamd" case? I can't see a way >> of dealing with that one - is it just a case of tough >> luck if you do it? Thanks! >> >> Alan >>
