SMF是Solaris 10重要的特性之一,要開始熟悉它的操作,才會知道如何管理系統服務。
用svcs -a可以檢視現在系統所有的服務。
$svcs -a|more
STATE STIME FMRI
legacy_run Aug_17 lrc:/etc/rcS_d/S29wrsmcfg
legacy_run Aug_17 lrc:/etc/rc2_d/S10lu
legacy_run Aug_17 lrc:/etc/rc2_d/S20sysetup
......
disabled Aug_17 svc:/system/device/mpxio-upgrade:default
disabled Aug_17 svc:/system/metainit:default
disabled Aug_17 svc:/network/iscsi_initiator:default
disabled Aug_17 svc:/network/ipfilter:default
.......
online Aug_18 svc:/system/console-login:default
online Oct_17 svc:/network/telnet:default
offline Aug_17 svc:/application/print/rfc1179:default
$
用svcs -x可以檢視現在系統未正常啟動的服務,通常會與**-v一起使用,讓你知道什麼相關服務導致無法啟動。像底下這個svc:/application/print/rfc1179:default就是導致svc:/application/print/server:default**服務無法啟動的原因。
$svcs -x
svc:/application/print/server:default (LP print server)
State: disabled since Sun Aug 17 11:39:27 2008
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: lpsched(1M)
Impact: 1 dependent service is not running. (Use -v for list.)
svcs -xv
svc:/application/print/server:default (LP print server)
State: disabled since Sun Aug 17 11:39:27 2008
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: man -M /usr/share/man -s 1M lpsched
Impact: 1 dependent service is not running:
svc:/application/print/rfc1179:default
**svcs -l <服務名稱>**則是用於檢視個服務的詳細資料,但某些服務必須由'root'權限的帳號才可以執行:
$svcs -l svc:/network/telnet:default
fmri svc:/network/telnet:default
name Telnet server
enabled true
state online
next_state none
state_time Fri Oct 17 16:19:00 2008
restarter svc:/network/inetd:default
svcs: Unable to get restarter for svc:/network/telnet:default: Permission denied
$ su - root
login!
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
#svcs -l svc:/network/telnet:default
fmri svc:/network/telnet:default
name Telnet server
enabled true
state online
next_state none
state_time Fri Oct 17 16:19:00 2008
restarter svc:/network/inetd:default
To faciliate SMF and SVCS, it will be better of learning XML syntax first before going into depth of Solaris 10 SMF and SVCS.
SMF is very different from the traditonal ways of Unix/Linux shell scripts ( startup, stop, refresh ...in /etc/inetd.conf something like that ).
XML is key components of SMF & SVCS, the wrong sytax of XML will cause the Solaris 10 failed to bring up and shutdown in Kernel and Service levels. ( Solaris does not provider the proper Parser & editor, the XML parser and editor still running in Windows environment will be better before uploading into Solaris 10 )
非常謝謝您的指導....看來我得先學學XML才行了..囧rz..