系统启动流程

POST-->BIOS(Boot Sequence)-->MBR(bootloader,446)-->Kernel-->initrd-->(ROOTFS)/sbin/init(/etc/inittab)

Kernel初始化的过程:
1、设备探测
2、驱动初始化(可能会从initrd(initramfs)文件中装载驱动模块)
3、以只读挂载根文件系统;
4、装载第一个进程init(PID:1)  (rw重新挂载rootfs)



initrd初始化的过程

/sbin/init:(/etc/inittab)
 upstart: ubuntu, d-bus, event-driven  # (比传统init速度快)
 systemd:                     #(并行启动多个进程)


/sbin/init(/etc/inittab) 的初始化过程


rh6采用upstart,inittab无需过多配置

[root@localhost ~]# cat /etc/inittab 
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:5:initdefault:
[root@localhost ~]#
[root@localhost ~]# uname -a
Linux localhost 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# ls /etc/init  #(inittab切割为多个*.conf文件;事件驱动)
control-alt-delete.conf  plymouth-shutdown.conf  rc.conf             rcS-sulogin.conf          readahead-disable-services.conf  start-ttys.conf
init-system-dbus.conf    prefdm.conf             rcS.conf            readahead-collector.conf  serial.conf                      tty.conf
kexec-disable.conf       quit-plymouth.conf      rcS-emergency.conf  readahead.conf            splash-manager.conf
[root@localhost ~]#
[root@localhost ~]# cat /etc/init/rcS.conf   #(事件驱动)
# rcS - runlevel compatibility
#
# This task runs the old sysv-rc startup scripts.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file rcS.override and put your changes there.

start on startup

stop on runlevel

task

# Note: there can be no previous runlevel here, if we have one it's bad
# information (we enter rc1 not rcS for maintenance).  Run /etc/rc.d/rc
# without information so that it defaults to previous=N runlevel=S.
console output
pre-start script
 for t in $(cat /proc/cmdline); do
  case $t in
   emergency)
    start rcS-emergency
    break
   ;;
  esac
 done
end script
exec /etc/rc.d/rc.sysinit
post-stop script
 if [ "$UPSTART_EVENTS" = "startup" ]; then
  [ -f /etc/inittab ] && runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab)
  [ -z "$runlevel" ] && runlevel="3"
  for t in $(cat /proc/cmdline); do
   case $t in
    -s|single|S|s) runlevel="S" ;;
    [1-9])       runlevel="$t" ;;
   esac
  done
  exec telinit $runlevel
 fi
end script
[root@localhost ~]#







主要分析rh5的inittab作用

(每一行代表运行一个进程)

id:3:initdefault:
id:runlevels:action:process

id: 标识符
runlevels: 在哪个级别运行此行;
action: 在什么情况下执行此行;
process: 要运行程序;
si::sysinit:/etc/rc.d/rc.sysinit 

action:
initdefault: 设定默认运行级别
sysinit: 系统初始化
wait: 等待级别切换至此级别时执行
respawn: 一旦程序终止,会重新启动


总结inittab脚本任务

/etc/inittab的任务:
1、设定默认运行级别;
2、运行系统初始化脚本;
3、运行指定运行级别对应的目录下的脚本;
4、设定Ctrl+Alt+Del组合键的操作;
5、定义UPS电源在电源故障/恢复时执行的操作;
6、启动虚拟终端(2345级别);
7、启动图形终端(5级别);



学习脚本:/etc/rc.d/rc.sysinit完成的任务(系统初始化):

[root@localhost ~]# wc -l /etc/rc.d/rc.sysinit 
681 /etc/rc.d/rc.sysinit
[root@localhost ~]# file /etc/rc.d/rc.sysinit 
/etc/rc.d/rc.sysinit: Bourne-Again shell script text executable

1、激活udev和selinux; (前200行左右)
2、根据/etc/sysctl.conf文件,来设定内核参数; 
3、设定时钟时钟;
4、装载键盘映射;
5、启用交换分区;
6、设置主机名;
7、根文件系统检测,并以读写方式重新挂载;
8、激活RAID和LVM设备;
9、启用磁盘配额;
10、根据/etc/fstab,检查并挂载其它文件系统;
11、清理过期的锁和PID文件;

for I in /etc/rc3.d/K*; do
  $I stop
done

for I in /etc/rc3.d/S*; do
  $I start
done


##: 关闭或启动的优先次序,数据越小越优先被选定
先关闭以K开头的服务,后启动以S开头的服务;

[root@localhost ~]# cat /etc/rc.d/rc
#! /bin/bash
#
# rc            This file is responsible for starting/stopping
#               services when the runlevel changes.
#
# Original Author:       
#               Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

set -m

# check a file to be a correct runlevel script
check_runlevel ()
{
 # Check if the file exists at all.
 [ -x "$1" ] || return 1
 is_ignored_file "$1" && return 1
 return 0
}

# Now find out what the current and what the previous runlevel are.
argv1="$1"
set $(/sbin/runlevel)
runlevel=$2
previous=$1
export runlevel previous

. /etc/init.d/functions

export CONSOLETYPE
do_confirm="no"
if [ -f /var/run/confirm ]; then
 do_confirm="yes"
fi
UPSTART=
[ -x /sbin/initctl ] && UPSTART=yes
# See if we want to be in user confirmation mode
if [ "$previous" = "N" ]; then
 if [ "$do_confirm" = "yes" ]; then
  echo $"Entering interactive startup"
 else
  echo $"Entering non-interactive startup"
 fi
fi

# Get first argument. Set new runlevel to this argument.
[ -n "$argv1" ] && runlevel="$argv1"

# Is there an rc directory for this new runlevel?
[ -d /etc/rc$runlevel.d ] || exit 0

# Set language, vc settings once to avoid doing it for every init script
# through functions
if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" ] ; then
  . /etc/profile.d/lang.sh 2>/dev/null
  export LANGSH_SOURCED=1
fi

# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do

 # Check if the subsystem is already up.
 subsys=${i#/etc/rc$runlevel.d/K??}
 [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] || continue
 check_runlevel "$i" || continue

 # Bring the subsystem down.
 [ -n "$UPSTART" ] && initctl emit --quiet stopping JOB=$subsys
 $i stop
 [ -n "$UPSTART" ] && initctl emit --quiet stopped JOB=$subsys
done

# Now run the START scripts.
for i in /etc/rc$runlevel.d/S* ; do

 # Check if the subsystem is already up.
 subsys=${i#/etc/rc$runlevel.d/S??}
 [ -f /var/lock/subsys/$subsys ] && continue
 [ -f /var/lock/subsys/$subsys.init ] && continue
 check_runlevel "$i" || continue
      
 # If we're in confirmation mode, get user confirmation
 if [ "$do_confirm" = "yes" ]; then
  confirm $subsys
  rc=$?
  if [ "$rc" = "1" ]; then
   continue
  elif [ "$rc" = "2" ]; then
   do_confirm="no"
  fi
 fi

 update_boot_stage "$subsys"
 # Bring the subsystem up.
 [ -n "$UPSTART" ] && initctl emit --quiet starting JOB=$subsys
 if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then
  export LC_ALL=C
  exec $i start
 fi
 $i start
 [ -n "$UPSTART" ] && initctl emit --quiet started JOB=$subsys
done
[ "$do_confirm" = "yes" ] && rm -f /var/run/confirm
exit 0
[root@localhost ~]#





启动的服务不同:
 运行级别:0-6

  0:halt
  1: single user mode, #直接以管理员身份切入, s,S,single
  2:multi user mode, no NFS
  3: multi user mode, text mode
  4:reserved
  5: multi user mode, graphic mode
  6: reboot
[root@localhost ~]# ls /etc/rc.d/rc0.d/  #(运行级别0)
K01smartd     K10psacct        K25sshd            K50snmptrapd  K74ntpd              K80kdump           K87irqbalance   K90network       K99rngd
K02rhsmcertd  K10saslauthd     K30postfix         K50xinetd     K75blk-availability  K83bluetooth       K87restorecond  K92ip6tables     K99sysstat
K03rhnsd      K15htcacheclean  K30spice-vdagentd  K60crond      K75netfs             K84NetworkManager  K88auditd       K92iptables      S00killall
K05atd        K15httpd         K50dnsmasq         K73winbind    K75ntpdate           K84wpa_supplicant  K88rsyslog      K95firstboot     S01halt
K05wdaemon    K16abrt-ccpp     K50netconsole      K74acpid      K75quota_nld         K85mdmonitor       K89portreserve  K99cpuspeed
K10cups       K16abrtd         K50snmpd           K74haldaemon  K75udev-post         K85messagebus      K89rdisc        K99lvm2-monitor
[root@localhost ~]# ls /etc/rc.d/rc6.d/  #(运行级别6)
K01smartd     K10psacct        K25sshd            K50snmptrapd  K74ntpd              K80kdump           K87irqbalance   K90network       K99rngd
K02rhsmcertd  K10saslauthd     K30postfix         K50xinetd     K75blk-availability  K83bluetooth       K87restorecond  K92ip6tables     K99sysstat
K03rhnsd      K15htcacheclean  K30spice-vdagentd  K60crond      K75netfs             K84NetworkManager  K88auditd       K92iptables      S00killall
K05atd        K15httpd         K50dnsmasq         K73winbind    K75ntpdate           K84wpa_supplicant  K88rsyslog      K95firstboot     S01reboot
K05wdaemon    K16abrt-ccpp     K50netconsole      K74acpid      K75quota_nld         K85mdmonitor       K89portreserve  K99cpuspeed
K10cups       K16abrtd         K50snmpd           K74haldaemon  K75udev-post         K85messagebus      K89rdisc        K99lvm2-monitor
[root@localhost ~]# ls /etc/rc.d/rc5.d/  #(运行级别5)
K01smartd        K50netconsole  K84wpa_supplicant  S08iptables     S15mdmonitor         S26acpid           S80postfix    S99firstboot
K05wdaemon       K50snmpd       K87restorecond     S10network      S20kdump             S26haldaemon       S82abrt-ccpp  S99local
K10psacct        K50snmptrapd   K89rdisc           S11auditd       S22messagebus        S26udev-post       S82abrtd
K10saslauthd     K73winbind     K99rngd            S11portreserve  S23NetworkManager    S50bluetooth       S90crond
K15htcacheclean  K74ntpd        S01sysstat         S12rsyslog      S25blk-availability  S55sshd            S95atd
K15httpd         K75ntpdate     S02lvm2-monitor    S13cpuspeed     S25cups              S56xinetd          S97rhnsd
K50dnsmasq       K75quota_nld   S08ip6tables       S13irqbalance   S25netfs             S70spice-vdagentd  S97rhsmcertd
[root@localhost ~]#




rc.d服务类脚本: 

 start 
 SysV: /etc/rc.d/init.d
  start|stop|restart|status
  reload|configtest


服务类脚本遵循的规则如下(自动创建链接):

# chkconfig: runlevels SS KK     当chkconfig命令来为此脚本在rc#.d目录创建链接时,runlevels表示默认创建为S*开头的链接,-表示没有级别默认为S*开头的链接;除此之外的级别默认创建为K*开头的链接;
 S后面的启动优先级为SS所表示的数字;K后面关闭优先次序为KK所表示的数字;
# description: 用于说明此脚本的简单功能; \, 续行

[root@localhost ~]# ls /etc/rc.d/init.d/ # (服务类脚本目录)
abrt-ccpp  blk-availability  firstboot     ip6tables     lvm2-monitor  NetworkManager  quota_nld    rsyslog    snmptrapd       winbind
abrtd      bluetooth         functions     iptables      mdmonitor     ntpd            rdisc        sandbox    spice-vdagentd  wpa_supplicant
abrt-oops  cpuspeed          haldaemon     irqbalance    messagebus    ntpdate         restorecond  saslauthd  sshd            xinetd
acpid      crond             halt          kdump         netconsole    portreserve     rhnsd        single     sysstat
atd        cups              htcacheclean  killall       netfs         postfix         rhsmcertd    smartd     udev-post
auditd     dnsmasq           httpd         lvm2-lvmetad  network       psacct          rngd         snmpd      wdaemon
[root@localhost ~]# cd /etc/rc.d/init.d/
[root@localhost init.d]# head acpid atd
==> acpid <==
#!/bin/bash
#
# /etc/rc.d/init.d/acpid
#
# Starts the acpi daemon
#
# chkconfig: 345 26 74    
# description: Listen and dispatch ACPI events from the kernel
# processname: acpid


==> atd <==
#!/bin/sh
#
# atd Starts/stop the "at" daemon
#
# chkconfig:   345 95 5
# description: Runs commands scheduled by the "at" command at the time \
#    specified when "at" was run, and runs batch commands when the load \
#    average is low enough.

### BEGIN INIT INFO
[root@localhost init.d]#


chkconfig   编译服务类脚本为不同级别下的独立守护服务
  

# chkconfig: runlevels SS KK     
 当chkconfig命令来为此脚本在rc#.d目录创建链接时,runlevels表示默认创建为S*开头的链接,-表示没有级别默认为S*开头的链接;除此之外的级别默认创建为K*开头的链接;
 S后面的启动优先级为SS所表示的数字;K后面关闭优先次序为KK所表示的数字;
# description: 用于说明此脚本的简单功能; \, 续行
chkconfig --list: 查看所有独立守护服务的启动设定;独立守护进程!
 chkconfig --list SERVICE_NAME
  
chkconfig --add SERVICE_NAME

chkconfig --del SERVICE_NAME

chkconfig [--level RUNLEVELS] SERVICE_NAME {on|off}
 #如果省略级别指定,默认为2345级别;


自定义服务类脚本myservice

[root@localhost init.d]# bash myservice.sh start
starting...
[root@localhost init.d]# bash myservice.sh status
running...
[root@localhost init.d]# bash myservice.sh stop
stoping...
[root@localhost init.d]# bash myservice.sh status
stopped
[root@localhost init.d]# cat myservice.sh 
#!/bin/bash

# chkconfig: 2345 88 11
# description: my test service

lockfile=/var/lock/subsys/myservice

case $1 in
start)
 echo "starting..."
 touch $lockfile ;;
stop)
 echo "stoping..."
 rm -f $lockfile &> /dev/null ;;
restart)
 echo "restarting...";;
status)
 if [ -e $lockfile ];then
  echo "running..."
 else
  echo "stopped"
 fi
 ;;
*)
 echo "`basename $0` {start|stop|restart|status}";;
esac
 
[root@localhost init.d]#
[root@localhost init.d]# chkconfig --list
NetworkManager  0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp       0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd           0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid           0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd             0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd          0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth       0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed        0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond           0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups            0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq         0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot       0:off 1:off 2:off 3:on 4:off 5:on 6:off
haldaemon       0:off 1:off 2:off 3:on 4:on 5:on 6:off
htcacheclean    0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables       0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables        0:off 1:off 2:on 3:on 4:on 5:on 6:off
irqbalance      0:off 1:off 2:off 3:on 4:on 5:on 6:off
kdump           0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor    0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor       0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus      0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole      0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs           0:off 1:off 2:off 3:on 4:on 5:on 6:off
network         0:off 1:off 2:on 3:on 4:on 5:on 6:off
ntpd            0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpdate         0:off 1:off 2:off 3:off 4:off 5:off 6:off
portreserve     0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix         0:off 1:off 2:on 3:on 4:on 5:on 6:off
psacct          0:off 1:off 2:off 3:off 4:off 5:off 6:off
quota_nld       0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc           0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond     0:off 1:off 2:off 3:off 4:off 5:off 6:off
rhnsd           0:off 1:off 2:on 3:on 4:on 5:on 6:off
rhsmcertd       0:off 1:off 2:off 3:on 4:on 5:on 6:off
rngd            0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog         0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd       0:off 1:off 2:off 3:off 4:off 5:off 6:off
smartd          0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmpd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmptrapd       0:off 1:off 2:off 3:off 4:off 5:off 6:off
spice-vdagentd  0:off 1:off 2:off 3:off 4:off 5:on 6:off
sshd            0:off 1:off 2:on 3:on 4:on 5:on 6:off
sysstat         0:off 1:on 2:on 3:on 4:on 5:on 6:off
udev-post       0:off 1:on 2:on 3:on 4:on 5:on 6:off
wdaemon         0:off 1:off 2:off 3:off 4:off 5:off 6:off
winbind         0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant  0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd          0:off 1:off 2:off 3:on 4:on 5:on 6:off

xinetd based services:
 chargen-dgram:  off
 chargen-stream: off
 daytime-dgram:  off
 daytime-stream: off
 discard-dgram:  off
 discard-stream: off
 echo-dgram:     off
 echo-stream:    off
 rsync:          off
 tcpmux-server:  off
 telnet:         on
 time-dgram:     off
 time-stream:    off
[root@localhost init.d]# 
[root@localhost init.d]# chkconfig --add myservice 
[root@localhost init.d]# find ./ -name myservice
./myservice
[root@localhost rc.d]# find ./ -name "*myservice"
./init.d/myservice
./rc0.d/K11myservice
./rc6.d/K11myservice
./rc2.d/S88myservice
./rc1.d/K11myservice
./rc3.d/S88myservice
./rc5.d/S88myservice
./rc4.d/S88myservice
[root@localhost rc.d]# chkconfig --del myservice
[root@localhost rc.d]# find ./ -name "*myservice"
./init.d/myservice
[root@localhost rc.d]# chkconfig --add myservice
[root@localhost rc.d]# find ./ -name "*myservice"
./init.d/myservice
./rc0.d/K11myservice
./rc6.d/K11myservice
./rc2.d/S88myservice
./rc1.d/K11myservice
./rc3.d/S88myservice
./rc5.d/S88myservice
./rc4.d/S88myservice
[root@localhost rc.d]# chkconfig --list myservice
myservice       0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost rc.d]# chkconfig --level 24 myservice off
[root@localhost rc.d]# chkconfig --list myservice
myservice       0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@localhost rc.d]#









/etc/rc.d/rc.local:系统最后启动的一个服务,准确说,应该执行的一个脚本;

[root@localhost rc.d]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
[root@localhost rc.d]#


守护进程的类型:
 独立守护进程
 xinetd:超级守护进程,代理人
  瞬时守护进程:不需要关联至运行级别
  

[root@localhost rc.d]# chkconfig --list xinetd
xinetd          0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@localhost rc.d]#
root@localhost rc.d]# chkconfig --list xinetd
xinetd          0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@localhost rc.d]# chkconfig --list
NetworkManager  0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp       0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd           0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid           0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd             0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd          0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth       0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed        0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond           0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups            0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq         0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot       0:off 1:off 2:off 3:on 4:off 5:on 6:off
haldaemon       0:off 1:off 2:off 3:on 4:on 5:on 6:off
htcacheclean    0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables       0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables        0:off 1:off 2:on 3:on 4:on 5:on 6:off
irqbalance      0:off 1:off 2:off 3:on 4:on 5:on 6:off
kdump           0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor    0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor       0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus      0:off 1:off 2:on 3:on 4:on 5:on 6:off
myservice       0:off 1:off 2:off 3:on 4:off 5:on 6:off
netconsole      0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs           0:off 1:off 2:off 3:on 4:on 5:on 6:off
network         0:off 1:off 2:on 3:on 4:on 5:on 6:off
ntpd            0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpdate         0:off 1:off 2:off 3:off 4:off 5:off 6:off
portreserve     0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix         0:off 1:off 2:on 3:on 4:on 5:on 6:off
psacct          0:off 1:off 2:off 3:off 4:off 5:off 6:off
quota_nld       0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc           0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond     0:off 1:off 2:off 3:off 4:off 5:off 6:off
rhnsd           0:off 1:off 2:on 3:on 4:on 5:on 6:off
rhsmcertd       0:off 1:off 2:off 3:on 4:on 5:on 6:off
rngd            0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog         0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd       0:off 1:off 2:off 3:off 4:off 5:off 6:off
smartd          0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmpd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmptrapd       0:off 1:off 2:off 3:off 4:off 5:off 6:off
spice-vdagentd  0:off 1:off 2:off 3:off 4:off 5:on 6:off
sshd            0:off 1:off 2:on 3:on 4:on 5:on 6:off
sysstat         0:off 1:on 2:on 3:on 4:on 5:on 6:off
udev-post       0:off 1:on 2:on 3:on 4:on 5:on 6:off
wdaemon         0:off 1:off 2:off 3:off 4:off 5:off 6:off
winbind         0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant  0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd          0:off 1:off 2:off 3:on 4:on 5:on 6:off

xinetd based services:  #(瞬时守护进程)
 chargen-dgram:  off
 chargen-stream: off
 daytime-dgram:  off
 daytime-stream: off
 discard-dgram:  off
 discard-stream: off
 echo-dgram:     off
 echo-stream:    off
 rsync:          off
 tcpmux-server:  off
 telnet:         on
 time-dgram:     off
 time-stream:    off
[root@localhost rc.d]# chkconfig rsync on
[root@localhost rc.d]# chkconfig --list
xinetd based services:
 chargen-dgram:  off
 chargen-stream: off
 daytime-dgram:  off
 daytime-stream: off
 discard-dgram:  off
 discard-stream: off
 echo-dgram:     off
 echo-stream:    off
 rsync:          on
 tcpmux-server:  off
 telnet:         on
 time-dgram:     off
 time-stream:    off