IT dragons tamed since 2006 (with 735 solutions and growing)

[login]
[join]

your IP[54.81.71.8]




If you thought this solution was helpfull, please login and vote. Not a member? click here

ID743
TitleService Management Facility (SMF) in Solaris
Byjohn
Keywordssmf svcadm svcs
CategorySolaris 10
Votes0
Views8
Score8
Date2017-04-20
Body


Service management facility was first introduced in Solaris 10 for managing system and
application services.
This replaces the legacy init scripts and other startup scripts.

Configuration files and directories

The files and directories used to manage/troubleshoot and configure SMF are :

/etc/svc/repository.dbThe actual database of SMF
/etc/svc/volatileLogs for early booting issues
/lib/svc/bin/svc.startdMaster restarter daemon
/lib/svc/bin/svc.configdRepository daemon
/var/svc/manifest/systemService XML files
/lib/svc/methodStartup shell script
/var/svc/logService log files are stored here

FMRI (Fault
Management Resource Identifier)

Every service has a FMRI which includes the service name and instance name. For example
:

svc:/system/cron (longer form)
svc:/system/cron:default (include the instance)

Whats the difference between a service and instance of a service
Consider the web service. A specific web server configured to listen on port 80 is an instance of
the web service.
The first instance of every service is normally tagged as tagged as the default instance. For
example cron will have the default instance
“svc:/system/cron:default”.

Components of a service

Most services are made up of 4 components. Consider the example of cron service :

XML file/var/svc/manifest/system/cron.xml
Daemon/usr/sbin/cron
FMRIsystem/cron (short form)
svc:/system/cron (longer
form)
svc:/system/cron:default (include the instance)
Log file/var/svc/log/system-cron:default.log

SMF commands

The different commands that are used to manage services and make configuration changes are :

svcsdisplays information about service
svcadmManage the state of the service instances
svcpropretrieve service configuration properties
svccfgimport, export, and modify service
configurations

Getting information on services

1. To list all the services (enable/disabled/maintenance) :

# svcs -a
STATE STIME FMRI
legacy_run 17:54:51 lrc:/etc/rc3_d/S81volmgt
online 13:47:55 svc:/network/telnet:default
online 13:47:55 svc:/network/nfs/rquota:default
online 13:47:55 svc:/network/ftp:default
........

2. To list all processes associated with each service instance, if any :

# svcs -p
online 13:47:45 svc:/system/sac:default
13:47:45 223 sac
13:47:45 227 ttymon
online 13:47:45 svc:/system/cron:default
13:47:45 226 cron
..........

3. To list all the details about a service :

# svcs -l system/cron
fmri svc:/system/cron:default
name clock daemon
enabled true
state online
next_state none
state_time Thu Dec 30 13:47:45 2004
logfile /var/svc/log/system-cron:default.log
restarter svc:/system/svc/restarter:default
contract_id 41
dependency require_all/none svc:/system/filesystem/local (online)
dependency require_all/none svc:/milestone/name-services (online)

4. To display broken services and the reason behind it :

# svcs -xv
svc:/application/print/server:default (LP print server)
State: disabled since Wed Mar 02 10:28:00 2005
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: man -M /usr/share/man -s 1M lpsched
Impact: 1 dependent service is not running:
svc:/application/print/rfc1179:default

SMF service states

Each SMF service will have one of the state mentioned in the table below. Using the svcadm
commands the states can be changed.

uninitializedinitial state of all services until svc.startd moves them to another
state
offlineEnabled but not running
onlineEnabled and running
maintenanceBroken due to some reason
disableddisabled instance
legacy-runService not managed directly by SMF

Service
dependencies

Service may depend on other service(s). Unless these services are not online, the dependent
service will not start.

1. To check dependent services (Service I depend on)

# svcs -d
/system/filesystem/local STATE STIME FMRI online 20:08:17 svc:/system/filesystem/minimal:default online 20:08:19 svc:/milestone/single-user:default

2. To check which services depends on a particular service (Services that depend on
me)
:

# svcs -D /system/filesystem/local
online         20:08:19 svc:/network/shares/group:default
online         20:08:19 svc:/system/cron:default
online         20:08:19 svc:/application/opengl/ogl-select:default
online         20:08:20 svc:/network/nfs/status:default
......

Service start/stop

Now that we’ve looked at the services and FMRI of the services, we can enable/disable the
services using the svcadm command. Make sure all the required dependency service are online before
you online the service.

# svcadm enable [service]To enable a service
# svcadm disable [service]To disable a service
# svcadm disable -t [service]Temporarily disable a service untill next
reboot
# svcadm clear [service]To clear a service in maintenance mode
# svcadm refresh [service]To refresh service to re-read the configuration
files.

Retrieving service configuration properties

Any service will have multiple properties associated with it. The syntax to list the property
value of a services is :

# svcprop -p [property] [service]

For example, to displays the shell script that starts the cron daemon :

# svcprop -p
start/exec system/cron /lib/svc/method/svc-cron

Modifying service configuration properties

The service configuration properties can be changed using the 3 modes of svccfg
command

* Interactive mode
* From a file that contains a series of subcommands
* Command line mode
# svccfg
svc:> select system/console-login
svc:/system/console-login> setprop ttymon/terminal_type = astring: vt100
svc:/system/console-login> quit

Make sure you refresh or clear (in case service is broken) the service to re-read the
configuration changes you made.

# svcadm refresh
system/console-login

SMF milestones

SMF milestones are services that aggregate multiple services and describe a specific state of
system. Sone of the milestones represent the run levels. To list all the milestones :

#
svcs milestone* STATE STIME FMRI online Jun_30 svc:/milestone/unconfig:default online Jun_30 svc:/milestone/config:default online Jun_30 svc:/milestone/devices:default online Jun_30 svc:/milestone/network:default online Jun_30 svc:/milestone/single-user:default online Jun_30 svc:/milestone/name-services:default online Jun_30 svc:/milestone/self-assembly-complete:default online Jun_30 svc:/milestone/multi-user:default online Jun_30 svc:/milestone/multi-user-server:default
SharediggDigg this solutiondel.icio.usPost to del.icio.usSlashdotSlashdot it!email to a friend
PrintPrint This Solution Print
If you thought this solution was helpfull, please login and vote. Not a member? click here


Latest News

Thanks to Dave for hosting this site!

Paying the Rent



Advanced Search:

Choose body, keywords, title, or all to include in search 
words to include in search 
and(+)

Choose body, keywords, title, or all to include in search 
additional words to include in search 
not(-)

Choose body, keywords, title, or all to exclude in search 
words to exclude from search 


catagory
order by






diggDigg Dracko
del.icio.usPost to del.icio.us
SlashdotSlashdot us!




Don't forget to vote!
Powered by John Core
Bye!

Dracko by John Core

me

View John Core's profile on LinkedIn


Certifications
security logo saber ccsa logo ccna-logo hbss veritas

Technologies
oracle_logo
solaris_logo linux-logo openstack_logo vbox_logo splunk storagetek_logo sun_logo oraclevm_logo brocade_logo bsd_logo

Languages
c-logo bash-logo php-logo

Employers
PlanetPayment Medecision AWi PennStateHershey DISA DLA cim Sun

Consulting
KMBS PNC FBI CCS PTD Sentinel