With Service Management Facility (SMF) you can provide  service management like rebooting, shutdown, refreshing with the service configuration. SMF also facilitates service dependencies like service A and service B are depended to each other which need to be in a proper managed order to start up.

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# who -r                             #current run level

  .       run-level 3  Feb 15 00:03     3      0  S

[/symple_box]

[symple_box color=”blue” text_align=”left” width=”100%” float=”none”]
SMF utilities
[/symple_box]

Service Management Facility (SMF) in Solaris 10_Part II_bashcodes

svcs – lists services and provide additional info like man pages.

svcadm – mostly shows service status , permits interaction with services and including state transitions

svccfg – permits interaction with service config database.

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# svcs

bash-3.2# svcs -a | less

STATE          STIME    FMRI

legacy_run     Feb_15   lrc:/etc/rcS_d/S50sk98sol

legacy_run     Feb_15   lrc:/etc/rc2_d/S81dodatadm_udaplt

legacy_run     Feb_15   lrc:/etc/rc2_d/S89PRESERVE

legacy_run     Feb_15   lrc:/etc/rc2_d/S94ncalogd

legacy_run     Feb_15   lrc:/etc/rc2_d/S98deallocate

legacy_run     Feb_15   lrc:/etc/rc3_d/S16boot_server

legacy_run     Feb_15   lrc:/etc/rc3_d/S50apache

legacy_run     Feb_15   lrc:/etc/rc3_d/S80mipagent

legacy_run     Feb_15   lrc:/etc/rc2_d/S05vmware-tools

 

bash-3.2# cd /etc/rc0.d/

bash-3.2# ls -ltr

total 28

-rwxr–r–   4 root     sys         1151 Jan 10  2005 K62lu

-rwxr–r–   5 root     sys         2329 Jan 22  2005 K34ncalogd

-rwxr–r–   6 root     sys          344 Jan 22  2005 K06mipagent

-rwxr–r–   5 root     sys         1718 Jan 22  2005 K50pppd

-rwxr–r–   6 root     sys          474 Jan 22  2005 K27boot.server

-rwxr–r–   5 root     sys          359 Jan 22  2005 K52llc2

-rwxr–r–   6 root     sys         2452 Jun 23  2010 K16apache

 [/symple_box]

While using the commands you will notice service starting with K gets killed after work is over.

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# ps -ef | grep startd

    root     9     1   0   Feb 15 ?           0:04 /lib/svc/bin/svc.startd

[/symple_box]

You will notice the PID of svc.startd is 9, and svc.startd is also called service restarter manager.

The inetd Restarter – This service states manages the responses to administrative requests, system and services failures.

control inetd services. INETD is a super server which proxies connections to servers.

inetadm – is the default, delegated service restarter for INETD deamons

FMRI’s provide categories services like network and milestones

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# svcs -d svc:/network/smtp:sendmail   #this command or svcs -d shows the dependencies needed to run the program. Returns required services for FMRI.

 

STATE          STIME    FMRI

online         Feb_15   svc:/milestone/name-services:default

online         Feb_15   svc:/system/identity:domain

online         Feb_15   svc:/network/service:default

online         Feb_15   svc:/system/filesystem/local:default

online         Feb_15   svc:/system/filesystem/autofs:default

online         Feb_15   svc:/system/system-log:default

 

bash-3.2# svcs -D svc:/network/smtp:sendmail   #svcs -D (with uppercase) returns services dependent on sendmail.

STATE          STIME    FMRI

online         Feb_15   svc:/milestone/multi-user:default

 

bash-3.2# svcs -l svc:/network/smtp:sendmail    #return verbose dependency

fmri         svc:/network/smtp:sendmail

name         sendmail SMTP mail transfer agent

enabled      true

state        online

next_state   none

state_time   Sat Feb 15 00:03:59 2014

logfile      /var/svc/log/network-smtp:sendmail.log

restarter    svc:/system/svc/restarter:default

contract_id  69

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)

 

bash-3.2# svcs -l smtp    #FMRI can be referenced by their unique parts.

bash-3.2# svcs -a  | grep -i network #shows all the network services.

bash-3.2# svcs -a | wc -l   #checks the total services running

    219

bash-3.2# svcs -a | grep smtp   #loads only one instance

 

online         Mar_13   svc:/network/smtp:sendmail

 

To check the SMF’s default log file location is /var/svc/log/close to that FMRI.log

 

bash-3.2# cd /var/svc/log #checking the log files

bash-3.2# ls -ltr

bash-3.2# ls -ltr | grep -i mile

bash-3.2# ls -ltr | grep -i send

bash-3.2# less network-smtp\:sendmail.log

bash-3.2# ps -ef | grep -i send #searches the services

    root  1063     1   0   Mar 13 ?           0:01 /usr/lib/sendmail -bl -q15m

  smmsp  1062     1   0   Mar 13 ?           0:01 /usr/lib/sendmail -Ac -q15m

bash-3.2# ps -ef | grep -i send

bash-3.2# !svcs

bash-3.2# svcs -l smtp

bash-3.2# ps -ef |grep -i sendmail    

bash-3.2# svcs –help #gives the possibilities with svcs
[/symple_box]

[symple_divider style=”solid” margin_top=”20px” margin_bottom=”20px”]

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

If you like the blog please follow us [icon name=”icon-facebook”] [icon name=”icon-twitter”] [icon name=”icon-google-plus-sign”]

[/symple_box]