You are on page 1of 3

Determining the systems runlevel:

#who r
Getting status report of a service:
#svcs -lp sendmail
Getting a status report on all services:
#svcs -a for smf controlled services
#inetadm for services controlled by inetd
Customizing a service or listing customisations:
#svccfg -s sendmail
#svccfg -s sendmail listcust
Dependency checking:
#svcs -D sendmail checks which service is dependent on sendmail
Determining which service instances are dependent on the multi-user
milestone:
#svcs -D multi-user
Determining the services a service instance is dependent on:
#svcs -d sendmail
Sending an email when transactions go to maintenance:
#svccfg setnotify -g maintenance mailto:sysadmins@example.com
Disabling a service:
#svcadm disable sendmail
The service can be disabled only when there are no dependent services.
Enabling a service:
#svcadm enable sendmail
#svcadm enable r sendmail enables required dependencies
Starting a service
#svcs d sendmail

Displaying the status of a service:


#svcs -l sendmail
Check if a service is enabled:
#svcs -x sendmail
Enabling a service in temp mode:
#svcadm enable -rt sendmail starts the service in temp mode. The service
wont persist across a reboot
Restarting a service:
#svcadm restart sendmail
Listing PIDs and service instances associated with a service (This is
required to check that all instances of a service that has entered
maintenance mode are stopped):
#svcs -p sendmail
Killing a service (for a service in maintenance):
#pkill -9 sendmail
Restoring a service (for a service in maintenance or degraded state):
#svcadm clear sendmail
SMF Profiles
A profile is an XML file which lists multiple services and states whether each should
be enabled or disabled. Profiles are useful when multiple services are required to be
started and another group needs to shut down.
Creating a new profile as a backup of the old:
#svccfg export > profile.xml
Change name of the profile and change enabled = true or false for each
service.
Applying a profile:
#svccfg apply profile.xml
SMTP notification for service state change
Install the SMTP package:

#pkg install service/fault-management/smtp-notify


Enable the service:
#svcadm enable smtp-notify
#ps ef | grep smtp
Setting up notification:
#svccfg s svc:/system/svc/global:default setnotify g from-online
mailto:root@localhost
This will enable notification for all services.
Enabling notification for one service only:
#svccfg -s svc:/network/http:apache22 setnotify -g from-online
mailto:root@localhost
Checking notification:
#svccfg -s svc:/system/svc/global:default listnotify
Deleting notification:
#svccfg -s svc:/network/http:apache22 delnotify -g all
Refresh and restart of a service are typically required when changing
configuration.

You might also like