Solaris 11 Command Cheat Sheet : Managing Services

What is the Service Management Facility?

The Oracle Solaris Service Management Facility (SMF) is responsible for managing system and pplication services, replacing the legacy init scripting start-up mechanism common to other UNIX operating systems. SMF helps improves the availability of a system by,  ensuring that essential services run continuously even in the event of any software or hardware failures with an automatic restart capability. SMF is a part of the wider predictive

Self-healing capability in Oracle Solaris. Another crucial component of this is the Fault Management Architecture (FMA), responsible for reporting and isolating failed hardware components.

Understanding the SMF Fault Managed Resource Indicator (FMRI)

Each SMF managed service instance is unique described by an FMRI, that an administrator can use to enable or disable the service, find out information about or modify configuration properties related to that service. For example, the file system automounter service  described by svc:/system/filesystem/autofs:default

FMRI Segment  Description
svc:/  FMRI scheme
system/filesystem  Service category
autofs  Service name
default  Service instance

 

Many SMF commands allow FMRI abbreviations by specifying the instance name, or any of the trailing portion of the service name, assuming it is unique on the system. For example, administrators could also refer to the above service as filesystem/autofs:default, autofs:default, and autofs. We will deliberately use multiple abbreviations in this cheat sheet.

Enabling, disabling and restarting services

Enable service svc:/network/smtp:sendmail:

 # svcadm enable smtp:sendmail

 

Disable service svc:/network/telnet:default:

# svcadm disable telnet

 

Restart service svc:/network/httpd:apache22:

 # svcadm restart apache22

 

Listing information about services

 

Show all enabled services (including temporarily disabled services):

 # svcs

Show all enabled and disabled services:

 # svcs -a

List detailed information about svc:/system/zones:default:

 # svcs -l zones:default

List processes associated with svc:/network/netcfg:default:

 # svcs -p network/netcfg

Show why services that are enabled but are not running (or preventing other services from running):

 # svcs –xv

Display all services which depend on the svc:/network/ssh:default:

 # svcs -D network/ssh

List all services svc:/network/ssh:default depends on:

 # svcs –d network/ssh

Show all service state notifications that are configured on a system:

 # svcs –n

 

Configuration layers in the SMF repository

 

Service configuration is defined in a number of layers within the SMF configuration repository that helps preserve any local administrative customizations during system upgrade, particularly when the underlying vendor provided default configuration changes. A service property could have different values at different layers of the repository. A simple priority mechanism is used to determine which  value is used by the service.

Configuration Layer  –>   Description

manifest             –>          Values provided as part of SMF manifests located in /lib/svc/manifest/

system-profile –>          Values provided as part of SMF profiles located in /etc/svc/profile/generic.xml

site-profile         –>          Values provided as part of SMF profile located in /etc/svc/profile/site/

admin                   –>          Values provided by interactive use of SMF commands or libraries

 

 

Listing service property configuration

 

List all properties (including inherited properties) of the service instance svc:/network/ssh:default:

 # svcprop ssh:default

List properties specific to the service instance svc:/network/ssh:default:

 # svcprop –c ssh:default

List the pkg/port property of the service instance svc:/application/pkg/server:default:

# svcprop –p pkg/server pkg/server:default

List all properties within the pkg property group of the service instancesvc:/application/pkg/server:default:

 # svcprop –p pkg pkg/server:default

Interactively display the general/enabled property for the servicesvc:/network/ssh:default:

 # svccfg

 svc:> select ssh:default

 svc:/network/ssh:default> listprop general/enabled

 svc:/network/ssh:default> exit

 # svccfg –s switch:default listcust –L

 

Setting service property configuration

Configure the config/nodename property on the svc:/system/identity:node service instance::

 # svccfg

 # svc:>select identity:node

 # svc:/system/identity:node> setprop config/nodename = “myhost”

 # svc:/system/identity:node> refresh

 # svc:/system/identity:node> exit

Configure the config/nameserver property on the svc:/network/dns/client service with two IP addresses:

 # svccfg –s dns/client

 svc:/network/dns/client> setprop config/nameserver =  (“192.168.0.1” “10.0.0.4”)

 svc:/network/dns/client> select default

 svc:/network/dns/client:default> refresh

List all configuration changes (at all layers) to svc:/system/nameservice/switch:default:

# svccfg –s switch:default listcust -L

Delete an administrative customization to the config/nameserver property in the svc:/network/dns/client service:

 # svccfg –s dns/client

 svc:/network/dns/client> delcust config/nameserver

 svc:/network/dns/client> refresh

Delete the config/nameserver property from the svc:/network/dns/client service (and thus masking it):

 # svccfg –s dns/client

 # svc:/network/dns/client> delprop config/nameserver

Extract an SMF system profile in order to apply configuration to other systems:

 # svccfg extract –a > system-profile.xml

Apply an SMF system profile to a system:

 # cp system-profile.xml /etc/svc/profile/site

 # svcadm restart manifest-import

 

 

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

2 Responses

  1. September 4, 2015

    […] Solaris 11 Command Cheat Sheet : Managing Services […]

  2. September 16, 2015

    […] Read Command Cheat Sheet : Managing Services […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us