Linux开机自启动目录

时间:2021-12-13 15:37:48

1、开机启动脚本

开机启动脚本是存放在 /etc/rc.d/rcX.d 目录中的,这里的X是runlevel,就是linux的运行级别,可以看到有rc0~rc6,共7种级别:

运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动
运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆
运行级别2:多用户状态(没有NFS)
运行级别3:完全的多用户状态(有NFS),登陆后进入控制台命令行模式
运行级别4:系统未使用,保留
运行级别5:X11控制台,登陆后进入图形GUI模式
运行级别6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动

[root@wc1 Desktop]# pwd
/root/Desktop
[root@wc1 Desktop]# cd /etc/rc.d

[root@wc1 rc.d]# ls -l
total 60
drwxr-xr-x. 2 root root 4096 Aug 16 14:58 init.d
-rwxr-xr-x. 1 root root 2617 Oct 16 2014 rc
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc0.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc1.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc2.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc3.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc4.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc5.d
drwxr-xr-x. 2 root root 4096 Aug 16 15:35 rc6.d
-rwxr-xr-x. 1 root root 220 Oct 16 2014 rc.local
-rwxr-xr-x. 1 root root 19914 Oct 16 2014 rc.sysinit


这里切换到rc3.d目录下,也就是完全的多用户模式:

[root@wc1 rc.d]# cd rc3.d
[root@wc1 rc3.d]# ls -l
total 0
lrwxrwxrwx. 1 root root 16 Aug 4 21:08 K01smartd -> ../init.d/smartd
lrwxrwxrwx. 1 root root 17 Aug 4 21:06 K02oddjobd -> ../init.d/oddjobd
lrwxrwxrwx. 1 root root 17 Aug 4 21:09 K05wdaemon -> ../init.d/wdaemon
lrwxrwxrwx. 1 root root 16 Aug 4 21:08 K10psacct -> ../init.d/psacct
lrwxrwxrwx. 1 root root 19 Aug 4 21:06 K10saslauthd -> ../init.d/saslauthd
lrwxrwxrwx. 1 root root 22 Aug 4 21:06 K15htcacheclean -> ../init.d/htcacheclean
lrwxrwxrwx. 1 root root 15 Aug 4 21:06 K15httpd -> ../init.d/httpd
lrwxrwxrwx. 1 root root 24 Aug 4 21:08 K30spice-vdagentd -> ../init.d/spice-vdagentd
lrwxrwxrwx. 1 root root 17 Aug 4 21:06 K50dnsmasq -> ../init.d/dnsmasq
lrwxrwxrwx. 1 root root 20 Aug 4 21:05 K50netconsole -> ../init.d/netconsole
lrwxrwxrwx. 1 root root 15 Aug 4 21:06 K50snmpd -> ../init.d/snmpd
lrwxrwxrwx. 1 root root 19 Aug 4 21:06 K50snmptrapd -> ../init.d/snmptrapd
lrwxrwxrwx. 1 root root 13 Aug 4 21:05 K60nfs -> ../init.d/nfs
lrwxrwxrwx. 1 root root 20 Aug 4 21:05 K69rpcsvcgssd -> ../init.d/rpcsvcgssd
lrwxrwxrwx. 1 root root 17 Aug 4 21:05 K73winbind -> ../init.d/winbind
lrwxrwxrwx. 1 root root 14 Aug 4 13:47 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx. 1 root root 17 Aug 4 21:06 K75ntpdate -> ../init.d/ntpdate
lrwxrwxrwx. 1 root root 19 Aug 4 21:08 K75quota_nld -> ../init.d/quota_nld
lrwxrwxrwx. 1 root root 16 Aug 4 21:06 K76ypbind -> ../init.d/ypbind
lrwxrwxrwx. 1 root root 15 Aug 4 13:47 K80kdump -> ../init.d/kdump
lrwxrwxrwx. 1 root root 24 Aug 16 15:35 K84wpa_supplicant -> ../init.d/wpa_supplicant
lrwxrwxrwx. 1 root root 21 Aug 4 21:05 K87restorecond -> ../init.d/restorecond
lrwxrwxrwx. 1 root root 14 Aug 16 15:35 K88sssd -> ../init.d/sssd
lrwxrwxrwx. 1 root root 15 Aug 4 21:05 K89rdisc -> ../init.d/rdisc
lrwxrwxrwx. 1 root root 19 Aug 4 13:47 K95firstboot -> ../init.d/firstboot
lrwxrwxrwx. 1 root root 14 Aug 4 21:08 K99rngd -> ../init.d/rngd
lrwxrwxrwx. 1 root root 17 Aug 4 21:07 S01sysstat -> ../init.d/sysstat
lrwxrwxrwx. 1 root root 22 Aug 4 21:07 S02lvm2-monitor -> ../init.d/lvm2-monitor
lrwxrwxrwx. 1 root root 22 Aug 16 14:59 S03vmware-tools -> ../init.d/vmware-tools
lrwxrwxrwx. 1 root root 19 Aug 4 21:06 S08ip6tables -> ../init.d/ip6tables
lrwxrwxrwx. 1 root root 18 Aug 4 21:05 S08iptables -> ../init.d/iptables
lrwxrwxrwx. 1 root root 17 Aug 4 21:05 S10network -> ../init.d/network
lrwxrwxrwx. 1 root root 16 Aug 4 21:08 S11auditd -> ../init.d/auditd
lrwxrwxrwx. 1 root root 21 Aug 4 21:02 S11portreserve -> ../init.d/portreserve
lrwxrwxrwx. 1 root root 17 Aug 4 21:06 S12rsyslog -> ../init.d/rsyslog
lrwxrwxrwx. 1 root root 18 Aug 4 21:08 S13cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx. 1 root root 20 Aug 4 21:06 S13irqbalance -> ../init.d/irqbalance
lrwxrwxrwx. 1 root root 17 Aug 4 21:03 S13rpcbind -> ../init.d/rpcbind
lrwxrwxrwx. 1 root root 19 Aug 4 21:05 S15mdmonitor -> ../init.d/mdmonitor
lrwxrwxrwx. 1 root root 20 Aug 4 21:02 S22messagebus -> ../init.d/messagebus
lrwxrwxrwx. 1 root root 24 Aug 4 21:06 S23NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx. 1 root root 17 Aug 16 15:35 S24nfslock -> ../init.d/nfslock
lrwxrwxrwx. 1 root root 17 Aug 16 15:35 S24rpcgssd -> ../init.d/rpcgssd
lrwxrwxrwx. 1 root root 26 Aug 4 21:07 S25blk-availability -> ../init.d/blk-availability
lrwxrwxrwx. 1 root root 14 Aug 4 21:05 S25cups -> ../init.d/cups
lrwxrwxrwx. 1 root root 15 Aug 4 21:05 S25netfs -> ../init.d/netfs
lrwxrwxrwx. 1 root root 15 Aug 4 21:08 S26acpid -> ../init.d/acpid
lrwxrwxrwx. 1 root root 19 Aug 4 21:05 S26haldaemon -> ../init.d/haldaemon
lrwxrwxrwx. 1 root root 19 Aug 4 21:05 S26udev-post -> ../init.d/udev-post
lrwxrwxrwx. 1 root root 16 Aug 4 21:06 S28autofs -> ../init.d/autofs
lrwxrwxrwx. 1 root root 19 Aug 4 21:06 S50bluetooth -> ../init.d/bluetooth
lrwxrwxrwx. 1 root root 14 Aug 4 21:07 S55sshd -> ../init.d/sshd
lrwxrwxrwx. 1 root root 32 Aug 16 14:59 S57vmware-tools-thinprint -> ../init.d/vmware-tools-thinprint
lrwxrwxrwx. 1 root root 15 Aug 16 15:35 S64mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 17 Aug 4 21:06 S80postfix -> ../init.d/postfix
lrwxrwxrwx. 1 root root 19 Aug 4 21:03 S82abrt-ccpp -> ../init.d/abrt-ccpp
lrwxrwxrwx. 1 root root 15 Aug 4 21:03 S82abrtd -> ../init.d/abrtd
lrwxrwxrwx. 1 root root 15 Aug 4 21:06 S90crond -> ../init.d/crond
lrwxrwxrwx. 1 root root 13 Aug 4 21:03 S95atd -> ../init.d/atd
lrwxrwxrwx. 1 root root 20 Aug 4 21:06 S99certmonger -> ../init.d/certmonger
lrwxrwxrwx. 1 root root 11 Aug 4 21:05 S99local -> ../rc.local

发现有很多K、S开头的后面跟着2位数字的文件,比如:K15httpd,K表示关闭,而15是指关闭的 优先级,也就是linux内核会按照系统预先设置好的runlevel,比如设置为3,那么就读取/etc/rc.d/rc3.d这个目录中的文件,然后按照先执行K开头,后执行S开头,并且从数字较小的开始执行,比如这里K15httpd,也就是排在第7个开始执行。

而且可以看到 K15httpd -> ../init.d/httpd ,也就是说 K15httpd是一个连接文件,连接到了相对于当前目录的上层目录下面的init.d/httpd,也就是目录/etc/rc.d/init.d :

[root@wc1 rc3.d]# ls -l /etc/rc.d/init.d
total 408
-rwxr-xr-x. 1 root root 1288 Oct 16 2014 abrt-ccpp
-rwxr-xr-x. 1 root root 1628 Oct 16 2014 abrtd
-rwxr-xr-x. 1 root root 1642 Oct 16 2014 abrt-oops
-rwxr-xr-x. 1 root root 1725 Aug 19 2010 acpid
-rwxr-xr-x. 1 root root 2062 Jan 30 2012 atd
-rwxr-xr-x. 1 root root 3580 Oct 15 2014 auditd
-rwxr-xr-x. 1 root root 4043 Oct 16 2014 autofs
-r-xr-xr-x. 1 root root 1340 Oct 16 2014 blk-availability
-rwxr-xr-x. 1 root root 710 Nov 11 2010 bluetooth
-rwxr-xr-x. 1 root root 2094 Oct 16 2014 certmonger
-rwxr-xr-x. 1 root root 11355 Aug 13 2013 cpuspeed
-rwxr-xr-x. 1 root root 2826 Nov 23 2013 crond
-rwxr-xr-x. 1 root root 3034 Oct 15 2014 cups
-rwxr-xr-x. 1 root root 1734 Jun 16 2014 dnsmasq
-rwxr-xr-x. 1 root root 3245 Jul 9 2013 firstboot
-rw-r--r--. 1 root root 19295 Jul 22 2014 functions
-rwxr-xr-x. 1 root root 1801 Oct 15 2014 haldaemon
-rwxr-xr-x. 1 root root 5866 Jul 22 2014 halt
-rwxr-xr-x. 1 root root 2001 Oct 16 2014 htcacheclean
-rwxr-xr-x. 1 root root 3371 Oct 16 2014 httpd
-rwxr-xr-x. 1 root root 10804 Oct 15 2014 ip6tables
-rwxr-xr-x. 1 root root 10688 Oct 15 2014 iptables
-rwxr-xr-x. 1 root root 1938 Jun 2 2014 irqbalance
-rwxr-xr-x. 1 root root 19476 Oct 16 2014 kdump
-rwxr-xr-x. 1 root root 652 Jul 22 2014 killall
-r-xr-xr-x. 1 root root 2134 Oct 16 2014 lvm2-lvmetad
-r-xr-xr-x. 1 root root 2757 Oct 16 2014 lvm2-monitor
-rwxr-xr-x. 1 root root 2571 Sep 5 2014 mdmonitor
-rwxr-xr-x. 1 root root 2200 Sep 14 2012 messagebus
-rwxr-xr-x. 1 root root 10815 Jul 3 2013 mysql
-rwxr-xr-x. 1 root root 2989 Jul 22 2014 netconsole
-rwxr-xr-x. 1 root root 6064 Jul 22 2014 netfs
-rwxr-xr-x. 1 root root 6334 Jul 22 2014 network
-rwxr-xr-x. 1 root root 2205 Oct 15 2014 NetworkManager
-rwxr-xr-x. 1 root root 6878 Oct 16 2014 nfs
-rwxr-xr-x. 1 root root 3526 Oct 16 2014 nfslock
-rwxr-xr-x. 1 root root 1923 Jul 15 2013 ntpd
-rwxr-xr-x. 1 root root 2043 Jul 15 2013 ntpdate
-rwxr-xr-x. 1 root root 2261 Jun 25 2011 oddjobd
-rwxr-xr-x. 1 root root 2023 Apr 3 2012 portreserve
-rwxr-xr-x. 1 root root 3912 Feb 20 2014 postfix
-rwxr-xr-x. 1 root root 1556 Jul 17 2012 psacct
-rwxr-xr-x. 1 root root 2034 Mar 5 2014 quota_nld
-rwxr-xr-x. 1 root root 1513 Sep 17 2013 rdisc
-rwxr-xr-x. 1 root root 1822 Oct 16 2014 restorecond
-rwxr-xr-x. 1 root root 1808 Dec 18 2011 rngd
-rwxr-xr-x. 1 root root 2073 Feb 22 2013 rpcbind
-rwxr-xr-x. 1 root root 2518 Oct 16 2014 rpcgssd
-rwxr-xr-x. 1 root root 2305 Oct 16 2014 rpcidmapd
-rwxr-xr-x. 1 root root 2464 Oct 16 2014 rpcsvcgssd
-rwxr-xr-x. 1 root root 2011 Aug 15 2013 rsyslog
-rwxr-xr-x. 1 root root 1698 Oct 16 2014 sandbox
-rwxr-xr-x. 1 root root 2056 Jun 23 2014 saslauthd
-rwxr-xr-x. 1 root root 647 Jul 22 2014 single
-rwxr-xr-x. 1 root root 3002 Feb 22 2013 smartd
-rwxr-xr-x. 1 root root 2162 Sep 15 2014 snmpd
-rwxr-xr-x. 1 root root 1738 Sep 15 2014 snmptrapd
-rwxr-xr-x. 1 root root 2472 Oct 15 2014 spice-vdagentd
-rwxr-xr-x. 1 root root 4621 Oct 15 2014 sshd
-rwxr-xr-x. 1 root root 2690 Oct 16 2014 sssd
-rwxr-xr-x. 1 root root 1144 Oct 16 2014 sysstat
-rwxr-xr-x. 1 root root 2294 Oct 16 2014 udev-post
-rwxr-xr-x. 1 root root 38525 Aug 16 14:58 vmware-tools
-rwxr-xr-x. 1 root root 15208 Aug 16 14:58 vmware-tools-thinprint
-rwxr-xr-x. 1 root root 1674 Feb 22 2013 wdaemon
-rwxr-xr-x. 1 root root 1608 Oct 15 2014 winbind
-rwxr-xr-x. 1 root root 1866 Feb 4 2013 wpa_supplicant
-rwxr-xr-x. 1 root root 4799 Feb 22 2013 ypbind
[root@wc1 rc3.d]#

再来看一下/etc/rc.d/init.d/httpd文件的内容:

[root@wc1 rc3.d]# cat /etc/rc.d/init.d/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac

exit $RETVAL
[root@wc1 rc3.d]#

2、另一个开机自启动目录

这个目录就是:/etc/init.d,目录里也存放了开机自启动脚本。

不过可以发现这个目录只不过是一个连接目录,实际上对应的就是/etc/rc.d/init.d,也就是上面讲到的目录,目录中的文件和/etc/rc.d/init.d 中的文件完全一致。

[root@wc1 rc3.d]# ls -l /etc/init.d
lrwxrwxrwx. 1 root root 11 Aug 4 21:02 /etc/init.d -> rc.d/init.d

[root@wc1 rc3.d]# ls -l /etc/init.d/
total 408
-rwxr-xr-x. 1 root root 1288 Oct 16 2014 abrt-ccpp
-rwxr-xr-x. 1 root root 1628 Oct 16 2014 abrtd
-rwxr-xr-x. 1 root root 1642 Oct 16 2014 abrt-oops
-rwxr-xr-x. 1 root root 1725 Aug 19 2010 acpid
-rwxr-xr-x. 1 root root 2062 Jan 30 2012 atd
-rwxr-xr-x. 1 root root 3580 Oct 15 2014 auditd
-rwxr-xr-x. 1 root root 4043 Oct 16 2014 autofs
-r-xr-xr-x. 1 root root 1340 Oct 16 2014 blk-availability
-rwxr-xr-x. 1 root root 710 Nov 11 2010 bluetooth
-rwxr-xr-x. 1 root root 2094 Oct 16 2014 certmonger
-rwxr-xr-x. 1 root root 11355 Aug 13 2013 cpuspeed
-rwxr-xr-x. 1 root root 2826 Nov 23 2013 crond
-rwxr-xr-x. 1 root root 3034 Oct 15 2014 cups
-rwxr-xr-x. 1 root root 1734 Jun 16 2014 dnsmasq
-rwxr-xr-x. 1 root root 3245 Jul 9 2013 firstboot
-rw-r--r--. 1 root root 19295 Jul 22 2014 functions
-rwxr-xr-x. 1 root root 1801 Oct 15 2014 haldaemon
-rwxr-xr-x. 1 root root 5866 Jul 22 2014 halt
-rwxr-xr-x. 1 root root 2001 Oct 16 2014 htcacheclean
-rwxr-xr-x. 1 root root 3371 Oct 16 2014 httpd
-rwxr-xr-x. 1 root root 10804 Oct 15 2014 ip6tables
-rwxr-xr-x. 1 root root 10688 Oct 15 2014 iptables
-rwxr-xr-x. 1 root root 1938 Jun 2 2014 irqbalance
-rwxr-xr-x. 1 root root 19476 Oct 16 2014 kdump
-rwxr-xr-x. 1 root root 652 Jul 22 2014 killall
-r-xr-xr-x. 1 root root 2134 Oct 16 2014 lvm2-lvmetad
-r-xr-xr-x. 1 root root 2757 Oct 16 2014 lvm2-monitor
-rwxr-xr-x. 1 root root 2571 Sep 5 2014 mdmonitor
-rwxr-xr-x. 1 root root 2200 Sep 14 2012 messagebus
-rwxr-xr-x. 1 root root 10815 Jul 3 2013 mysql
-rwxr-xr-x. 1 root root 2989 Jul 22 2014 netconsole
-rwxr-xr-x. 1 root root 6064 Jul 22 2014 netfs
-rwxr-xr-x. 1 root root 6334 Jul 22 2014 network
-rwxr-xr-x. 1 root root 2205 Oct 15 2014 NetworkManager
-rwxr-xr-x. 1 root root 6878 Oct 16 2014 nfs
-rwxr-xr-x. 1 root root 3526 Oct 16 2014 nfslock
-rwxr-xr-x. 1 root root 1923 Jul 15 2013 ntpd
-rwxr-xr-x. 1 root root 2043 Jul 15 2013 ntpdate
-rwxr-xr-x. 1 root root 2261 Jun 25 2011 oddjobd
-rwxr-xr-x. 1 root root 2023 Apr 3 2012 portreserve
-rwxr-xr-x. 1 root root 3912 Feb 20 2014 postfix
-rwxr-xr-x. 1 root root 1556 Jul 17 2012 psacct
-rwxr-xr-x. 1 root root 2034 Mar 5 2014 quota_nld
-rwxr-xr-x. 1 root root 1513 Sep 17 2013 rdisc
-rwxr-xr-x. 1 root root 1822 Oct 16 2014 restorecond
-rwxr-xr-x. 1 root root 1808 Dec 18 2011 rngd
-rwxr-xr-x. 1 root root 2073 Feb 22 2013 rpcbind
-rwxr-xr-x. 1 root root 2518 Oct 16 2014 rpcgssd
-rwxr-xr-x. 1 root root 2305 Oct 16 2014 rpcidmapd
-rwxr-xr-x. 1 root root 2464 Oct 16 2014 rpcsvcgssd
-rwxr-xr-x. 1 root root 2011 Aug 15 2013 rsyslog
-rwxr-xr-x. 1 root root 1698 Oct 16 2014 sandbox
-rwxr-xr-x. 1 root root 2056 Jun 23 2014 saslauthd
-rwxr-xr-x. 1 root root 647 Jul 22 2014 single
-rwxr-xr-x. 1 root root 3002 Feb 22 2013 smartd
-rwxr-xr-x. 1 root root 2162 Sep 15 2014 snmpd
-rwxr-xr-x. 1 root root 1738 Sep 15 2014 snmptrapd
-rwxr-xr-x. 1 root root 2472 Oct 15 2014 spice-vdagentd
-rwxr-xr-x. 1 root root 4621 Oct 15 2014 sshd
-rwxr-xr-x. 1 root root 2690 Oct 16 2014 sssd
-rwxr-xr-x. 1 root root 1144 Oct 16 2014 sysstat
-rwxr-xr-x. 1 root root 2294 Oct 16 2014 udev-post
-rwxr-xr-x. 1 root root 38525 Aug 16 14:58 vmware-tools
-rwxr-xr-x. 1 root root 15208 Aug 16 14:58 vmware-tools-thinprint
-rwxr-xr-x. 1 root root 1674 Feb 22 2013 wdaemon
-rwxr-xr-x. 1 root root 1608 Oct 15 2014 winbind
-rwxr-xr-x. 1 root root 1866 Feb 4 2013 wpa_supplicant
-rwxr-xr-x. 1 root root 4799 Feb 22 2013 ypbind


3、总结

/etc/rc.d/rcX.d 目录下面的文件是连接文件,连接到/etc/rc.d/init.d 目录下的文件,而/etc/init.d 目录就是链接目录,连接到 /etc/rc.d/init.d 目录。