James Carlson wrote: > Antonello Cruz writes: >> James Carlson wrote: >>> 'svcs -Ho CTID <fmri>' should be expected to produce stable output, so >>> you ought to be able to do this to get the PIDs in a service: >> Right, but that's not what's in svcs(1). >> It says: >> "Screen output is Uncommitted. The invocation is Committed." > > That's entirely reasonable for the default output. It's not at all > reasonable for the things that are clearly meant to be used within > scripts. I'd consider the '-Ho' format to be Committed, unless > someone on the project team had a clear rationale why it should not > be, and had shipped it in S10 FCS with clear warnings about that > specific form.
Setting aside possible rationales for the commitment level of svcs output, the best way to solve the problem today would be to use svcprop. svcprop's output isn't just committed, svcprop was intended for use in scripts. This is how you would use it: $ svcprop -p restarter/contract $fmri (And yes, pgrep -c is totally the way to go once you have the contract ID,) Dave