实际上,所有服务仅位于/etc/init.d下:
rc0.d contains the services which runs in runlevel 0
rc1.d contains the services which runs in runlevel 1
rc2.d contains the services which runs in runlevel 2
rc3.d contains the services which runs in runlevel 3
rc4.d contains the services which runs in runlevel 4
rc5.d contains the services which runs in runlevel 5
rc6.d contains the services which runs in runlevel 6
还有一件事,所有服务也都在下面显示rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d
,但这只是一个符号链接/etc/init.d
。
请看这里,这是rc1.d
目录的内容:
lrwxrwxrwx 1 root root 20 Aug 17 14:54 K15pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx 1 root root 22 Nov 28 18:47 K20acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root 20 Aug 17 14:54 K20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 23 Nov 7 15:24 K20openbsd-inetd -> ../init.d/openbsd-inetd
lrwxrwxrwx 1 root root 15 Aug 17 14:54 K20saned -> ../init.d/saned
lrwxrwxrwx 1 root root 27 Aug 17 14:54 K20speech-dispatcher -> ../init.d/speech-dispatcher
-rw-r--r-- 1 root root 369 Apr 14 2012 README
lrwxrwxrwx 1 root root 19 Aug 17 14:54 S30killprocs -> ../init.d/killprocs
lrwxrwxrwx 1 root root 19 Aug 17 14:54 S70dns-clean -> ../init.d/dns-clean
在这里,您可以观察到init.d的符号链接(K15pulseaudio-> ../init.d/pulseaudio)。
但是这里每个服务都链接到init.d,对吗?但是,每项服务都不会启动;原因是两个脚本。
第一个是S脚本(S30killprocs)--->开始
第二个是k脚本(K15pulseaudio)---> kill
所有K脚本服务都将终止该服务,所有S脚本服务将为该运行级别启动服务。
简单来说
S70dns-clean -> ../init.d/dns-clean
dns-clean
在运行级别1中启动服务。
K15pulseaudio -> ../init.d/pulseaudio
pulseaudio
在运行级别1中终止服务。
chkconfig --list
会正常吗?on
表示该服务正在该运行级别上运行,并且该服务将在系统启动时自动启动。