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…).