SMF Service ADMIN

por | 10 agosto, 2008


-bash-3.00# which svcadm
/usr/sbin/svcadm
-bash-3.00# svcadm
Usage: svcadm [-v] [cmd [args ... ]]

svcadm enable [-rst] ... - enable and online service(s)
svcadm disable [-st] ... - disable and offline service(s)
svcadm restart ... - restart specified service(s)
svcadm refresh ... - re-read service configuration
svcadm mark [-It] ... - set maintenance state
svcadm clear ... - clear maintenance state
svcadm milestone [-d] - advance to a service milestone

Services can be specified using an FMRI, abbreviation, or fnmatch(5)
pattern, as shown in these examples for svc:/network/smtp:sendmail

svcadm svc:/network/smtp:sendmail
svcadm network/smtp:sendmail
svcadm network/*mail
svcadm network/smtp
svcadm smtp:sendmail
svcadm smtp
svcadm sendmail
-bash-3.00#

Maintenance mode: Example Upgrade a service

Once completed maintenance mode, you have to clear

#### Service Management with svcadm ######

Disable service:

svcadm disable FMRI

svcadm disable -s FMRI – stops each service instance

svcadm disable -s sendmail – stop default instance

svcadm disable -t FMRI – effects temporary disable ( when systems reboots it will start )

Note: svcadm really delegates service management to default restarter. i.e. svc.startd


0-bash-3.00# grep svc /etc/inittab
# For modifying parameters passed to ttymon, use svccfg(1m) to modify
# # svccfg
# svc:> select system/console-login
# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
# svc:/system/console-login> exit
smf::sysinit:/lib/svc/bin/svc.startd >/dev/msglog 2<>/dev/msglog

Enable service:

svcadm enable FMRI - enables FMRI accross ALL reboots
svcadm enable -t FMRI - enables FMRI for current sessions ( test, developers )
svcadm enable -r FMRI - ALL dependencies are enabled ( recursive switch )
svcadm enable -s FMRI - enables each service instance

svcadm -v refresh smtp ( reread configuration files of smtp, same PID)

svcadm -v restart smtp ( new PIDS)

PIDS

-bash-3.00# svcs -p smtp
STATE STIME FMRI
online 0:36:17 svc:/network/smtp:sendmail
0:36:17 1219 sendmail
0:36:17 1220 sendmail