Service Management Facility has many features which helps to manage various services. Apart from that there are many commands which helps to get quick access on the services.

Service Management Facility (SMF) in Solaris 10 - Part III_bashcodes

[symple_box color=”blue” text_align=”left” width=”100%” float=”none”]
Managing Service Management with svcadm
[/symple_box]

svcadm services is used to manage the services by starting, stopping or restoring services

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

bash-3.2# which svcadm    #check where is the file located

/usr/sbin/svcadm

bash-3.2# svcs -a | grep milestone

disabled       Mar_13   svc:/milestone/patching:default

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

online         Mar_13   svc:/milestone/network:default

online         Mar_13   svc:/milestone/devices:default

online         Mar_13   svc:/milestone/single-user:default

online         Mar_13   svc:/milestone/sysconfig:default

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

online         Mar_13   svc:/milestone/multi-user-server:default

 svcs -a | grep online  #list of online services

 svcs -a | grep online | wc -l #number of online service

 bash-3.2# svcadm disable sendmail #disabling the sendmail service

bash-3.2# echo $?

0

 bash-3.2# svcs -a | grep smtp  # checking status of the smtp service

disabled       17:11:11 svc:/network/smtp:sendmail

bash-3.2# ps -ef | grep -i sendmail    # shows service disabled from your current user

bash-3.2# echo $?     #returns value other than 0 which means last transaction was unsuccessful.

[/symple_box]

[symple_box color=”blue” text_align=”left” width=”100%” float=”none”]
Most common commands used with svcadm
[/symple_box]

svcadm disable FMRI

svcadm disable -s FMRI    #stops the service instance

svcadm disable -s sendmail    #stops the default service instance

svcadm disable -t FMRI    #effects temprary disable till the next reboot

svcadm -x | grep sendmail    #check the current status of the send mail with description

svcadm -l | grep sendmail    #shows the full status of the service.

svcadm enable FMRI

svcadm enable sendmail    #this can be any unique portion of the FMRI which system recognizes.

Note: svcadm delegates the service management to default restarter i.e svc.start.d

svcadm enable -t FMRI    #enables FMRI for the current session, after reboot the service won’t enable and running

svcadm enable -r FMRI    #enables ALL the dependencies of the FMRI

svcadm enable -s FMRI    #enables all the instances if you have multi sessions.

svcadm -v refresh smtp    #rereads the action.

svcadm -v restart smtp     #restarts the service with new PID.

svc – l grep smtp     #check the service was restarted time and current time.

tail /var/svc/log/network-smtp: sendmail.log   #gives the log file of the restart done

[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]