Predictable
Stephen Hahn's blog at Sun Microsystems
All | Pastime | Person | Peruse | Position | Process | Product

« A peek while bug... | Main | The tantalizing... »
20040726 Monday July 26, 2004

Enabling and disabling services

I thought I would show a different example of smf(5) today. Here's the state of the network/telnet service on my desktop:

# svcs -p network/telnet:default
STATE          STIME    FMRI
online         Jul_23   svc:/network/telnet:default

It's easy to enable and disable service instances using svcadm(1M):

# svcadm disable network/telnet
# svcs -p network/telnet:default
STATE          STIME    FMRI
disabled       13:08:15 svc:/network/telnet:default
# telnet localhost
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

And we can enable it just as easily, too:

# svcadm enable network/telnet
# svcs -p network/telnet:default
STATE          STIME    FMRI
online         13:08:29 svc:/network/telnet:default

Note that while something is declaring telnet service is available, no processes are associated with the service instance. If we "telnet localhost" from another window, we can then see the telnet daemon and the login session:

# svcs -p network/telnet:default
STATE          STIME    FMRI
online         13:08:52 svc:/network/telnet:default
               13:08:52   116400 in.telnetd
               13:08:52   116403 login

Support for enabling and disabling services can be done by calling smf_enable_instance(3SCF) and smf_disable_instance(3SCF), in addition to the command line interface of svcadm(1M). Since the framework relays the enable or disable request, we don't need privileges to signal any process (or even know which process we might have to signal to make the update...).

(2004-07-26 13:15:43.0) Permalink Comments [5]
Comments:

Wow! This is pretty cool. I've been part of the external customer beta program for S10 and have been looking forward to seeing the SMF stuff. Are the changes persistent across reboots, or is there a seperate way to make changes persistent? Being able to see what's running and disable/enable things like this is a huge improvement for UNIX in general. Octave

Posted by Octave Orgeron on July 27, 2004 at 09:30 AM PDT #

@Octave: by default, enable and disable operations are persistent. You can specifically request temporary enabling or disabling�these will last only for the duration of the OS instance, and will reset on the next reboot. For example, <code>svcadm enable -t network/smtp:sendmail</code> would turn on Sendmail for the current boot of the OS, if it was previously disabled.

Posted by Stephen on July 27, 2004 at 09:39 AM PDT #

That's very handy. Do you see this replacing the inetd.conf type stuff? I'm all for replacing such things for something intelligent like SMF. I'll keep my eye out for testing this feature when it's available:)

Posted by Octave Orgeron on July 27, 2004 at 01:32 PM PDT #

@Octave: <code>inetd.conf</code>(4)'s contents have indeed been absorbed. We're very glad to hear you're willing to take it out for a test drive.

Posted by Stephen Hahn on July 27, 2004 at 03:50 PM PDT #

Stephen, Great news! I'm glad to see inetd.conf retired. I think it's really exciting to see soo many new features in S10 and improvements that other Unices don't have at all:)

Posted by Octave Orgeron on July 28, 2004 at 07:31 AM PDT #

Post a Comment:

Comments are closed for this entry.
Stephen Hahn
Sun Microsystems
sch@sun.com
17 Network Circle
MS MPK17-301
Menlo Park CA 94025 USA