Monday, March 12, 2012

Service Management Facility(SMF) in Solaris10

Service Management Facility is a new feature added  to Solaris10. It has several advantages when compared with previous versions of solaris.

Some of the advantages are listed below.

1.SMF provides flexibility to root user to  view and manage services.
2. The system administrator can  also enable, disable , restart  and modify the system   services.
3. The dependency of  a service on other services are also maintained by SMF.
4. SMF  starts the services in correct order of their dependency.
5. SMF also starts the services in parallel according to the dependency so that the boot time is quicker than the previous versions of solaris.

Two important commands used in SMF are svcs and svcadm.

svcs :- Used to display information about all the services.

Common options used with svcs are :-

svcs  -a :-  Shows all the services
 example:-
legacy_run     Feb_28   lrc:/etc/rc2_d/S47pppd
legacy_run     Feb_28   lrc:/etc/rc2_d/S70uucp

disabled 15:48:41 svc:/network/shell:kshell
disabled 15:48:41 svc:/network/talk:default
disabled 15:48:42 svc:/network/apocd/udp:default
online 15:47:44 svc:/system/svc/restarter:default
online 15:47:47 svc:/network/pfil:default
online 15:47:48 svc:/network/loopback:default
online 15:47:50 svc:/system/filesystem/root:default


svcs  -d :- shows the dependent services.
 example:-
svcs -d svc:/network/ssh:default
STATE       STIME      FMRI
online         Feb_28    svc:/network/loopback:default
online         Feb_28    svc:/network/physical:default
online         Feb_28   svc:/system/cryptosvc:default
online         Feb_28   svc:/system/filesystem/local:default
online         Feb_28   svc:/system/utmp:default
online         Feb_28   svc:/system/filesystem/autofs:default

svcs -x :- Describes the state of the service.
   example:-
   svcs -x svc:/network/ssh:default
   svc:/network/ssh:default (SSH server)
   State: online since Tue Feb 28 16:01:46 2012
   See: sshd(1M)
   See: /var/svc/log/network-ssh:default.log
   Impact: None.



 svcs -l :- Displays detailed information about the service.
 example:-
svcs -l svc:/network/ssh:default
fmri         svc:/network/ssh:default
name         SSH server
enabled      true
state        online
next_state   none
state_time   Tue Feb 28 16:01:46 2012
logfile      /var/svc/log/network-ssh:default.log
restarter    svc:/system/svc/restarter:default
contract_id  61
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (online)
dependency   require_all/none svc:/system/cryptosvc (online)
dependency   require_all/none svc:/system/utmp (online)
dependency   require_all/restart file://localhost/etc/ssh/sshd_config (online)

The state of each service can be one of the following

 disabled: The service instance is not enabled and is not running.
 legacy_run: The legacy service is not managed by the SMF, but the service can be
observed. This state is only used by legacy services that are started with RC scripts.
 maintenance: The service instance has encountered an error that must be resolved by
the administrator.
 offline: The service instance is enabled, but the service is not yet running or available
to run.
online: The service instance is enabled and has successfully started.
uninitialized: This state is the initial state for all services before their configuration
has been read.

svcadm is  Used to perform common service management tasks such as enabling, disabling, or restarting service instances.

The svcadm command allows the following sub commands

enable: Enables the service instances.
 example:-
 svcadm enable  svc:/network/swat/tcp:default

disable: Disables the service instances.
 example:-
svcadm disable svc:/network/swat/tcp:default

restart: Restarts the service instance
example:-
svcadm restart svc:/network/swat/tcp:default
 
 refresh: Refresh the service instance
 example :-
svcadm refresh  svc:/network/swat/tcp:default





No comments:

Post a Comment