Linux menu

Thursday, September 10, 2015

Service Management Facility I

Solaris 10 Services

There is a new feature to the way Solaris 10 handles services, this feature is called Service Management facility (SMF).

Terminology

Fault managed resource identifiers (FMRI) identifies services

            svc :/system/system- log:default

svc:Service type
/system/system-logName
:defaultInstance
The repository is the source for all known services on the system, it imports the service manifest into the database and then never references the manifest again.
The manifest properties are the following and are contained in a xml file (see appendix A).
  • Name of service
  • Number of instances
  • Start, stop and refresh methods
  • Property groups
  • Service model
  • Fault handling
  • Documentation template
A milestone is a predefined set of capabilities for a set of services, similar to a run level

File locations
SMF log files/var/svc/log
SMF log files/etc/svc/volatile
SMF manifests/var/svc/manifest/*
SMF method/lib/svc/method/*

Daemons
start svc daemonsvc.startd
svc configuration daemonsvc.configd

Service Commands 
Show the state of all servicessvcs –a
Show detailed informationsvcs –l
Show the dependenciessvcs –d
Show the dependentssvcs –D
show the processes of a servicesvcs –p
Explain why the service failedsvcs –x
verbose informationsvcs –v
Disable a service (stop)svcadm disable
Enabled a service (start)svcadm enable
restart a servicesvcadm restart
Reread the config file (HUP)svcadm refresh
Put service into maintenance/degrade modesvcadm mark
Start a service to the desired milestone levelsvcadm milestone
Show values for a given propertysvcprop –p
show details from a snapshotsvcprop –s

INETD services commands
List all configured inetd servicesinetadm
Detailed information on a inetd serviceinetadm -l
enable a inetd serviceinetadm -e
disable a inetd serviceinetadm -d

Administration

If a service fails to start
            # svcs –xv

To modify the properties of an inetd service
# inetadm –m spray bind_addr=”192.168.0.1”
# inetadm –l spray

Repair a corrupt repository using the default repository
Script# /lib/svc/bin/restore_repository          (follow the prompts)Note: all old repositories are in /etc/svc you can use an old one in place of the global
Manually# pstop “ pgrep svc.startd”
# kill svc.configd
# cp /etc/svc/repository.db /etc/svc/repository.badGlobal zone
# cp /lib/svc/seed/global.db /etc/svc/repository.db
# reboot
Non-Global zone
# cp /lib/svc/seed/nonglobal.db /etc/svc/repository.db
# reboot (only reboot zone)

Note: all old repositories are in /etc/svc you can use an old one in place of the global

Start service interactively during boot
Ok> boot –m milestone=none (login as root)
# svcadm milestone –t all         (enable all services)
# svcs –l                         (look for hanging services and check log files /var/svc/log)
continue with normal boot procedures
Other boot commands are:
Ok> boot –m verbose               (verbose output)
Ok> boot –m debug                  (very verbose output)

Manifests

To check the integrity of a manifest xml file
       # /usr/bin/xmllint mysvc.xml
To import your service manifest           
       # /usr/sbin/svccfg -v import /var/svc/manifest/site/mysvc.xml                                                                 
Appendix A – screen shots

List of services configured
# svcs
legacy_run      Mar_02    lrc :/etc/rc3_d/S80mipagent
legacy_run      Mar_02    lrc :/etc/rc3_d/S81volmgt
legacy_run      Mar_02    lrc :/etc/rc3_d/S82initsma
legacy_run      Mar_02    lrc :/etc/rc3_d/S84appserv
legacy_run      Mar_02    lrc :/etc/rc3_d/S90samba
online          Mar_02    svc:/system/svc/ restarter:default
online          Mar_02    svc:/network/ pfil:default
online          Mar_02    svc:/system/ filesystem/root:default
online          Mar_02    svc:/network/ loopback:default
online          Mar_02    svc:/milestone/name- services:default
offline         Mar_02    svc:/application/print/ ipp-     listener:default
offline         Mar_02    svc:/application/print/rfc1179:default

A detailed list of a service
# svcs –l sendmail
fmri          svc:/network/ smtp:sendmail
name          sendmail SMTP mail transfer agent
enabled       true
state         online
next_state    none
state_time    Thu 03 Mar 2005 07:05:07 AM GMT
logfile       / var/svc/log/network-smtp:sendmail.log
restarter     svc:/system/svc/ restarter:default
contract_ id   216
dependency    require_all/refresh file://localhost/etc/mail/sendmail.cf (online)
dependency    require_all/refresh file://localhost/etc/nsswitch.conf (online)
dependency    optional_all/none svc:/system/ filesystem/autofs (online)
dependency    require_all/none svc:/system/ filesystem/local (online)
dependency    require_all/none svc:/network/service (online)
dependency    require_all/refresh svc:/milestone/name-services (online)
dependency    optional_all/refresh svc:/system/ identity:domain (online)
dependency    optional_all/none svc:/system/system-log (online)


No comments: