ONLamp.com
oreilly.comSafari Books Online.Conferences.

advertisement


Using Solaris SMF
Pages: 1, 2, 3, 4

Controlling Services

Enable or disable a service using the svcadm command:



# svcs -x telnet
svc:/network/telnet:default (Telnet server)
 State: online since Thu Sep 22 07:51:11 2005
   See: in.telnetd(1M)
   See: telnetd(1M)
Impact: None.

# svcadm disable svc:/network/telnet:default

# svcs -x telnet
svc:/network/telnet:default (Telnet server)
 State: disabled since Sun Feb 19 23:32:40 2006
Reason: Disabled by an administrator.
   See: http://sun.com/msg/SMF-8000-05
   See: in.telnetd(1M)
   See: telnetd(1M)
Impact: This service is not running.

The configuration state of a service is recorded in the service repository, so changes to that state persist across reboots. If you disable telnet, rebooting the host won't bring it back up. You must explicitly reenable it from the command line. Make a temporary change to the state of a service by adding the -t option to svcadm:

# svcadm disable -t network/telnet

There are six different service states for configured SMF services.

online
The service is enabled and is running or available to run, or the tasks associated with this service are complete.
offline
The service is enabled but has not yet reached the online state. It is either in the process of starting up, or the dependencies of the service are not yet online.
disabled
The service is not enabled and should not be running.
degraded
The service is running but in a limited capacity. The Sun documentation is very vague about what "degraded" means, and suggests that the programs associated with the service are responsible for making that determination.
maintenance
The service has a problem, and it cannot continue to run or complete a task. A service in this state usually requires administrative intervention. The restarter for the service won't try to bring the service online until it has been cleared.
legacy-run
This is the default state for legacy run services.

The process of starting or stopping a service is listed in the service manifest. Most services have a method script associated with them that handle starting and stopping the service, just like an rc script. The restarter service runs this script to bring the service online or offline.

The svcadm command gives administrators a standard interface for controlling services. svcadm recognizes several service management commands:

enable
Brings the service online.
disable
Takes the service offline.
restart
Restarts the service process, either by performing a disable followed by an enable, or a specific programmed method to restart the service.
refresh
The refresh method rereads the service properties from the repository. This is useful if someone made configuration changes to the service definition. If that service is controlled by svc.startd and that service also defines an internal refresh method, then the refresh method runs. A program that is usually refreshed rereads its configuration file.
clear
Resets a service that is in the maintenance state.
mark (degraded or maintenance)
Deliberately sets the state of a service to either degraded or maintenance. This is usually used for debugging a service.

The svcadm command is more picky about wildcards, unlike svcs. You can still use abbreviated FMRIs and wildcards, as long as they match only one full FMRI.

# svcadm refresh svc:/network/login
svcadm: Pattern 'svc:/network/login' matches multiple instances:
        svc:/network/login:rlogin
        svc:/network/login:klogin
        svc:/network/login:eklogin

# svcadm refresh "svc:/*rlogin"

# svcs "*rlogin"
STATE          STIME    FMRI
online         23:24:17 svc:/network/login:rlogin

Pages: 1, 2, 3, 4

Next Pagearrow





Sponsored by: