Solaris Service Management Facility (SMF)
Under the Solaris 10 OE and OpenSolaris the Service Management Facility (SMF) has been upgraded, and there are great new tools to handle the sysadmin work on the services.
Full details are available @ Solaris Service Management Facility Quickstart Guide
Summary of commands to administer services and make configuration changes to the system:
Command | Description |
---|---|
svcadm | Manage the state of service instances |
svcs | Provide information about services, including their status |
svcprop | Get information about service configuration properties |
svccfg | Import, export, and modify service configuration |
To see the detailed boot sequence with all the services notices use:
ok> boot -m verbose
Stopping and starting services
To stop a running service as well as make sure it wont restart after rebooting the server:
# svcadm disable service_name
Bring the service back up and make sure it starts after boot as well:
# svcadm enable service_name
The new and improved SMF will also watch over the service, and restart it if it suddenly stops, but don't worry if the service loops and can't start, after a couple of time the SMF will stop trying to bring it up, and will send you an error for the service.
To stop or start the service temporarily without impacting the startup status of the service use:
# svcadm -t disable service_name
# svcadm -t enable service_name
Getting information about the services
List all active services:
svcs
List all available services:
svcs -a
List all failing services:
svcs -x
to get more details on a specific failing service, use:
svcs -x service_name
to add verbosity to the svcs commands just add -v
the services logs are located in /var/svc/log or /etc/svc/volatile
List all the processes this service is running, even if they have a different name:
svcs -p service_name
Viewing Dependencies
List all the services this service is depended upon, if any of these services fails, our service will fail too:
svcs -d service_name
List all the services that depend on our service, if our service fails, they will fail too:
svcs -D service_name
Service Names
The explanation for the service names I'm taking straight from Sun's SunSolve site
Solaris uses a URI string called an FMRI (Fault Managed Resource Identifier) to identify system objects for which advanced fault and resource management capabilities are provided. Services managed by SMF are assigned FMRI strings prefixed with the scheme name svc, as shown in the following examples for the Solaris service syslogd(1M):
Notice that these service FMRI's used by SMF can be expressed in three ways:
- svc://localhost/system/system-log:default
- svc:/system/system-log:default
- system/system-log:default
- first as an absolute path including a location path such as localhost
- second as a path relative to the local machine
- third as simply the service identifier with the string prefixes implied.
Note that SMF also supports abbreviated FMRIs. All following commands are thus equivalent:
- svcs -l svc:/network/ssh:default
- svcs -l network/ssh:default
- svcs -l ssh:default
- svcs -l ssh
The SMF administrator tools described in the rest of this document typically describe services using the third form, as they are assumed to be operating on local services. Other management tools that operate on multiple types of resources or across machine boundaries may use one of the other forms to describe services.
The SMF tools in the current release of Solaris can only manage services on the local host.
Summary of SMF Service States
State | Description |
---|---|
uninitialized | Initial state of all services until its restarter (usually svc.startd) moves services to another state |
offline | The instance is enabled but not yet running or unable to run |
online | The instance is enabled and running |
maintenance | The instance is enabled but unable to run for some reason, and administrative action will be required |
disabled | The instance is disabled |
legacy-run | The service is not directly managed by SMF, but it was started at some point |
Solaris RunLevel
There are no longer run levels setting on the Solaris server, now this is called milestones.
Milestones are a group of services, which defines a state the server is in just like single user, or multi user, you can bring the server into a specific milestone with:
# svcadm milestone milestone/single-user:default
to permanently set the server in a specific mile stone, use:
# svcadm milestone -d milestone/single-user:default
and again to list what services should be running to reach a specific milestone, use:
# svcs -d milestone_name
and that's that! see my other post on how to add a service of your own.