Primary SMF Utilities

por | 9 agosto, 2008

3 Primary SMF Utilities:

1. svcs – lists services and provides additional info
2. svcadm – permits interation with services, including state transitions.
3. svccfg – permits interaction with service configuration database

bash-3.00# svcs -a |less
STATE STIME FMRI
legacy_run 14:43:50 lrc:/etc/rc2_d/S10lu
legacy_run 14:43:50 lrc:/etc/rc2_d/S20sysetup
legacy_run 14:43:50 lrc:/etc/rc2_d/S40llc2
legacy_run 14:43:50 lrc:/etc/rc2_d/S42ncakmod
legacy_run 14:43:51 lrc:/etc/rc2_d/S47pppd
legacy_run 14:43:51 lrc:/etc/rc2_d/S70uucp
legacy_run 14:43:51 lrc:/etc/rc2_d/S72autoinstall
legacy_run 14:43:51 lrc:/etc/rc2_d/S73cachefs_daemon
legacy_run 14:43:51 lrc:/etc/rc2_d/S81dodatadm_udaplt
legacy_run 14:43:51 lrc:/etc/rc2_d/S89PRESERVE
legacy_run 14:43:51 lrc:/etc/rc2_d/S89bdconfig
legacy_run 14:43:51 lrc:/etc/rc2_d/S91ifbinit
legacy_run 14:43:51 lrc:/etc/rc2_d/S91jfbinit
legacy_run 14:43:51 lrc:/etc/rc2_d/S94ncalogd
legacy_run 14:43:51 lrc:/etc/rc2_d/S98deallocate
legacy_run 14:43:52 lrc:/etc/rc2_d/S99nxsensor
legacy_run 14:43:52 lrc:/etc/rc3_d/S16boot_server
legacy_run 14:43:52 lrc:/etc/rc3_d/S50apache
legacy_run 14:43:52 lrc:/etc/rc3_d/S52imq
legacy_run 14:43:52 lrc:/etc/rc3_d/S80mipagent
legacy_run 14:43:52 lrc:/etc/rc3_d/S84appserv
legacy_run 14:43:52 lrc:/etc/rc3_d/S99nxsensor
:

bash-3.00# cat /etc/inittab
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# The /etc/inittab file controls the configuration of init(1M); for more
# information refer to init(1M) and inittab(4). It is no longer
# necessary to edit inittab(4) directly; administrators should use the
# Solaris Service Management Facility (SMF) to define services instead.
# Refer to smf(5) and the System Administration Guide for more
# information on SMF.
#
# For modifying parameters passed to ttymon, use svccfg(1m) to modify
# the SMF repository. For example:
#
# # svccfg
# svc:> select system/console-login
# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
# svc:/system/console-login> exit
#
#ident "@(#)inittab 1.41 04/12/14 SMI"
ap::sysinit:/sbin/autopush -f /etc/iu.ap
sp::sysinit:/sbin/soconfig -f /etc/sock2path
smf::sysinit:/lib/svc/bin/svc.startd >/dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog

svc.startd – is the default service restarter/manager
inetadm – is the default, delegated service restarter

FMRIs provide categories for services:
1. network
2. milestones
3. platform
4. system
etc…

0-bash-3.00# svcs -a | grep -i platform
disabled 14:43:24 svc:/platform/sun4u/efdaemon:default
online 14:43:27 svc:/platform/sun4v/drd:default
online 14:43:31 svc:/platform/sun4v/efdaemon:default

Syntax for ‘svcs’

svcs -d FMRI – returns required services for FMRI

Example sendmail:

returns all the services, that must be started before sendmail can start successfully

-bash-3.00# svcs -d svc:/network/smtp:sendmail
STATE STIME FMRI
online 14:43:21 svc:/milestone/name-services:default
online 14:43:27 svc:/system/identity:domain
online 14:43:28 svc:/network/service:default
online 14:43:30 svc:/system/filesystem/local:default
online 14:43:49 svc:/system/filesystem/autofs:default
online 14:43:49 svc:/system/system-log:default

what other services relly on sendmail


bash-3.00# svcs -D svc:/network/smtp:sendmail
STATE STIME FMRI
online 14:43:52 svc:/milestone/multi-user:default

svcs -l FMRI – returns verbose dependencies


-bash-3.00# svcs -l smtp
fmri svc:/network/smtp:sendmail
name sendmail SMTP mail transfer agent
enabled true
state online
next_state none
state_time Sat Aug 09 14:43:50 2008
logfile /var/svc/log/network-smtp:sendmail.log
restarter svc:/system/svc/restarter:default
contract_id 63
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)

svcs -l smtp – FRMIs can usually be referenced by their unique parts.
SMF’s default log location for services is : /var/svc/log/


bash-3.00# ps -ef | grep -i sendmail
smmsp 545 1 0 14:43:51 ? 0:00 /usr/lib/sendmail -Ac -q15m
root 546 1 0 14:43:51 ? 0:00 /usr/lib/sendmail -bd -q15m
root 2351 2339 0 18:24:31 pts/1 0:00 grep -i sendmail

Next… SMF Service Admin