Wednesday, February 16, 2011

smf


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-log
Name

:default
Instance
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 daemon
svc.startd
svc configuration daemon
svc.configd
Service Commands   
Show the state of all services
svcs –a
Show detailed information
svcs –l
Show the dependencies
svcs –d
Show the dependents
svcs –D
show the processes of a service
svcs –p
Explain why the service failed
svcs –x
verbose information
svcs –v
Disable a service (stop)
svcadm disable
Enabled a service (start)
svcadm enable
restart a service
svcadm restart
Reread the config file (HUP)
svcadm refresh
Put service into maintenance/degrade mode
svcadm mark
Start a service to the desired milestone level
svcadm milestone
Show values for a given property
svcprop –p
show details from a snapshot
svcprop –s
INETD services commands
List all configured inetd services
inetadm
Detailed information on a inetd service
inetadm -l
enable a inetd service
inetadm -e
disable a inetd service
inetadm -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.bad
Global 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:

Post a Comment