Solaris 10学习笔记

http://www.princeton.edu/~unix/Solaris/troubleshoot/smf.html
http://www.sun.com/software/solaris/howtoguides/servicemgmthowto.jsp
http://ni461nixiaoxiao.spaces.live.com/blog/cns!4922C9D850F521BE!509.entry
http://www.ixdba.net/hbcms/article/e1/246.html


1.runlevel
/etc/inittab
查看当前运行级别
who -r
修改级别
/usr/sbin/init 2

who -r查看级别
bash-3.00# who -r
   .       run-level 2  Mar  2 00:31     2      0  3

2.SMF
a)svcs - lists services and provides additional info
svcs状态
1. Online / Offline
2. legacy_run / maintenance
3. uninitialized / degraded / disable
svcs -a
http://hi.baidu.com/jouby/blog/item/2219362bea5cb6f0e6cd4003.html
1.# svcs -a
显示系统上所有的服务及其它们的状态.
1. disabled Apr_18 svc:/network/rpc/keyserv:default
2. disabled Apr_18 svc:/network/rpc/nisplus:default
3. disabled Apr_18 svc:/application/print/server:default
4. disabled Apr_18 svc:/network/dhcp-server:default
5. disabled Apr_18 svc:/network/http:apache2
6. online Apr_18 svc:/system/svc/restarter:default
7. online Apr_18 svc:/network/pfil:default
8. online Apr_18 svc:/network/physical:default
9. online Apr_18 svc:/system/identity:domain
10. online Apr_18 svc:/system/cryptosvc:default
11. online Apr_18 svc:/network/inetd:default
12. online Apr_18 svc:/network/telnet:default
13. online Apr_18 svc:/network/ssh:default
14. online Apr_18 svc:/system/zones:default
15. online Apr_18 svc:/network/nfs/nlockmgr:default
16. offline Apr_18 svc:/application/print/ipp-listener:default
17. offline Apr_18 svc:/application/print/rfc1179:default
2.svcs service
查看单个服务及其状态
# svcs inetd
STATE STIME FMRI
online Apr_18 svc:/network/inetd:default
# svcs apache2
STATE STIME FMRI
disabled Apr_18 svc:/network/http:apache2
3.svcs –d service
显示该服务所依赖的服务,如
# svcs -d inetd
disabled Apr_18 svc:/network/inetd-upgrade:default
online Apr_18 svc:/milestone/name-services:default
online Apr_18 svc:/network/loopback:default
online Apr_18 svc:/milestone/network:default
online Apr_18 svc:/system/filesystem/local:default
online Apr_18 svc:/network/rpc/bind:default
online Apr_18 svc:/milestone/sysconfig:default
3.svcs –D service
显示依赖于该服务的服务,如
# svcs -D inetd
STATE STIME FMRI
online Apr_18 svc:/milestone/multi-user:default
4.svcs –p service
显示该服务的进程号,如:
# svcs -p apache2
STATE STIME FMRI
online 11:25:33 svc:/network/http:apache2
11:25:33 2438 httpd
11:25:34 2439 httpd
11:25:34 2440 httpd
11:25:34 2441 httpd
11:25:34 2442 httpd
11:25:34 2443 httpd
5.svcs –l service
显示该服务的所有可用信息,如:
# svcs -l apache2
fmri svc:/network/http:apache2
name Apache 2 HTTP server
enabled true
state online
next_state none
state_time Wed Jun 07 11:47:04 2006
logfile /var/svc/log/network-http:apache2.log
restarter svc:/system/svc/restarter:default
contract_id 297
dependency require_all/error svc:/network/loopback:default (online)
dependency optional_all/error svc:/network/physical:default (online)
6.svcs –x service
此命令可以显示有关该服务的一些解释信息,如:
#svcs -x http
svc:/network/http:apache2 (Apache 2 HTTP server)
State: online since Tue Jun 06 11:28:05 2006
See: apache2(1M)
See: /var/svc/log/network-http:apache2.log
Impact: None.

b) svcadm - permits interaction with services including state transitions
http://blog.chinaunix.net/u/12270/showart_63598.html
http://docs.sun.com/app/docs/doc/819-6955/gdopt?a=view
Usage: svcadm [-v] [cmd [args ... ]]

        svcadm enable [-rst] <service> ...      - enable and online service(s)
        svcadm disable [-st] <service> ...      - disable and offline service(s)
        svcadm restart <service> ...            - restart specified service(s)
        svcadm refresh <service> ...            - re-read service configuration
        svcadm mark [-It] <state> <service> ... - set maintenance state
        svcadm clear <service> ...              - clear maintenance state
        svcadm milestone [-d] <milestone>       - 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 <cmd> svc:/network/smtp:sendmail
        svcadm <cmd> network/smtp:sendmail
        svcadm <cmd> network/*mail
        svcadm <cmd> network/smtp
        svcadm <cmd> smtp:sendmail
        svcadm <cmd> smtp
        svcadm <cmd> sendmail
svcadm disable -t FMRI - effects temporary diable
svcadm disable -s FMRI - stop each service instance

svcadm enable -t FMRI - enables FMRI for current session
svcadm enable -r FMRI - all dependencies are enable

 

c) svccfg - permits interaction with service configuration database

d) svc.startd - is the default service restarter/manager

e) inetadm  - is the default,delegated service restarter for INETD service.

inetdadm -d telnet 关闭telnet服务

inetadm -e telnet 开启telnet服务

修改telnet参数
inetadm -m telnet bindaddr=33
Usage:
  inetadm
  inetadm -?
  inetadm -p
  inetadm -l {FMRI | pattern}...
  inetadm -e {FMRI | pattern}...
  inetadm -d {FMRI | pattern}...
  inetadm -m {FMRI | pattern}... {name=value}...
  inetadm -M {name=value}...


http://server.it168.com/server/2007-08-28/200708280712331_2.shtml
http://www.ixpub.net/thread-297316-1-1.html

 

3.信息查看

showrev

bash-3.00# showrev
Hostname: solaris.ifeng.com
Hostid: 1182b4aa
Release: 5.10
Kernel architecture: i86pc
Application architecture: i386
Hardware provider:
Domain:
Kernel version: SunOS 5.10 Generic_139556-08

 

4.查看硬件

所有的硬件信息

prtconf

内存大小

prtconf | grep -i memory

 

 CPU个数和信息

psrinfo

0       on-line   since 03/02/2010 17:54:49

 

psrinfo  -p(个数)

1

 

psrinfo -pv

CPU和数和详细信息

 

5.操作系统信息

isainfo -vb

32-bit i386 applications
        sse4.1 ssse3 sse3 sse2 sse fxsr mmx cmov sep cx8 tsc fpu

 

列举程序工作目录

pwdx pid

 

关闭程序
pkill

 

程序状态

prstat

 

6.包管理

 install - shell script that runs with text/GUI interfaces

 

你可能感兴趣的:(Solaris 10学习笔记)