While procrastinating on a more important task, I've quickly coded up
the enhancement to svcs -l to print the service methods.  That'd be the
fix for this bug:
  http://bugs.opensolaris.org/view_bug.do?bug_id=6532480

We've talked about this before here:
  http://www.opensolaris.org/jive/thread.jspa?messageID=99513&#99513

Code is here.  I'd appreciate feedback by Friday.  It's small.
  http://cr.opensolaris.org/~lianep/6532480/

Example output:

  $ ./svcs -l telnet
  fmri         svc:/network/telnet:default
  name         Telnet server
  enabled      false
  state        disabled
  next_state   none
  state_time   Tue Sep 18 10:10:03 2007
  restarter    svc:/network/inetd:default
  method       inetd_start /usr/sbin/in.telnetd
  method       inetd_disable :kill

  $ ./svcs -l sendmail
  fmri         svc:/network/smtp:sendmail
  name         sendmail SMTP mail transfer agent
  enabled      true
  state        online
  next_state   none
  state_time   Tue Sep 18 10:10:01 2007
  logfile      /var/svc/log/network-smtp:sendmail.log
  restarter    svc:/system/svc/restarter:default
  method       start /lib/svc/method/smtp-sendmail start
  method       stop /lib/svc/method/smtp-sendmail stop %{restarter/contract}
  method       refresh /lib/svc/method/smtp-sendmail refresh
  contract_id  67 
  dependency   [...]

I've currently elected to leave the method tokens (see smf_method(5))
unexpanded.  That's because it's not always clear I could expand them
correctly given the current service state.  For example, if sendmail
wasn't running, the %{restarter/contract} wouldn't expand to anything
sensible.  But, its existance is important data for someone trying to
debug or understand sendmail's operation.  (Which I think is the most
common use of this output.)

I also decided to leave the method name out of the fixed width field,
as method name length is variable.  I think the space separation
between method name and the actual method is a reasonable choice, but
am happy to hear feedback on anything that increases human usability
without sacrificing output format or potential machine parseability.

liane

Reply via email to