Solaris系统,跟windows类似,也是有服务概念的.最常用的服务,有ssh,telnet.在windows中,服务的管理是通过运行services.msc,进入系统服务管理界面中管理的.在Solaris底下,也有类似工具.
1.服务查看
svcs可以查看系统中的服务.加上-a开关后,可以查看被disable了的服务,即被禁止启动了的服务.
----------------------------------------------------------------
bash-3.00# svcs -a | less
STATE STIME FMRI
legacy_run 15:00:58 lrc:/etc/rc3_d/S52imq
legacy_run 15:00:58 lrc:/etc/rc3_d/S80mipagent
legacy_run 15:00:58 lrc:/etc/rc3_d/S84appserv
disabled 15:00:21 svc:/system/metainit:default
disabled 15:00:21 svc:/system/device/mpxio-upgrade:default
disabled 15:00:22 svc:/network/ipsec/ike:default
关于服务状态,从man smf中了解到,Solaris系统中的服务有以下状态:
UNINITIALIZED This is the initial state for all service
instances. Instances are moved to mainte-
nance, offline, or a disabled state upon
evaluation by svc.startd(1M) or the
appropriate restarter.
OFFLINE The instance is enabled, but not yet run-
ning or available to run. If restarter exe-
cution of the service start method or the
equivalent method is successful, the
instance moves to the online state.
Failures might lead to a degraded or
maintenance state. Administrative action
can lead to the uninitialized state.
ONLINE The instance is enabled and running or is
available to run. The specific nature of
the online state is application-model
specific and is defined by the restarter
responsible for the service instance.
Online is the expected operating state for
a properly configured service with all
dependencies satisfied. Failures of the
instance can lead to a degraded or mainte-
nance state. Failures of services on which
the instance depends can lead to offline or
degraded states.
DEGRADED The instance is enabled and running or
available to run. The instance, however, is
functioning at a limited capacity in com-
parison to normal operation. Failures of
the instance can lead to the maintenance
state. Failures of services on which the
instance depends can lead to offline or
degraded states. Restoration of capacity
should result in a transition to the online
state.
MAINTENANCE The instance is enabled, but not able to
run. Administrative action is required to
restore the instance to offline and subse-
quent states. The maintenance state might
be a temporarily reached state if an admin-
istrative operation is underway.
DISABLED The instance is disabled. Enabling the ser-
vice results in a transition to the offline
state and eventually to the online state
with all dependencies satisfied.
LEGACY-RUN This state represents a legacy instance
that is not managed by the service manage-
ment facility. Instances in this state have
been started at some point, but might or
might not be running. Instances can only be
observed using the facility and are not
transferred into other states.
----------------------------------------------------------------
2.服务起停
svcadm用来对服务进行起停禁用管理.
用法:svcadm [-v] [命令 [参数 ...]]
svcadm enable [-rst] <服务> ... - 启用服务并使服务联机
svcadm disable [-st] <服务> ... - 禁用服务并使服务脱机
svcadm restart <服务> ... - 重新启动指定的服务
svcadm refresh <服务> ... - 重新读取服务配置
svcadm mark [-It] <状态> <服务> ... - 设置维护状态
svcadm clear <服务> ... - 清除维护状态
svcadm milestone [-d] <里程碑> - 进入服务里程碑
3.服务配置与修改
可以通过svccfg来修改系统的服务,不过由于对Solaris了解的不深,所以我也不太敢去修改系统中的服务.
暂时就记录这么多.