现在的位置: 首页 > 综合 > 正文

ubuntu中没有/etc/inittab文件探究

2013年03月07日 ⁄ 综合 ⁄ 共 1386字 ⁄ 字号 评论关闭
linux 启动时第一个进程是/sbin/init,其主要功能就是软件执行环境,包括系统的主机名、网络设置、语系处理、文件系统格式及其他服务的启动等。其配置文件就是/etc/inittab,但在我的ubuntu10.10却没有找到此文件。
原来ubuntu中使用/etc/event.d这个目录,完成相似的功能。ubuntu9.10版本的upstart不再用/etc/event.d这个目录了。而是改用/etc/init目录。在/etc/init/下发现一个文件rc-sysinit.conf,与rc.sysinit文件名相似,于是打开发现其中有如下内容:
	# rc-sysinit - System V initialisation compatibility
	#	
	# This task runs the old System V-style system initialisation scripts,

	# and enters the default runlevel when finished.
	# Check for default runlevel in /etc/inittab
	   
	 if [ -r /etc/inittab ]		   
		 then				
		eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)"
	 fi
	......	

	# Run the system initialisation scripts		  
	[ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS
很明显,在ubuntu还是支持/etc/initab文件的。脚本的最后会执行/etc/init.d/rcS, rcS的内容为::
	#! /bin/sh	
	#	
	# rcS	
	#	
	# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order	
	#

文件中所有的语句竟然都被注释掉了,看来此文件的存在只是为了兼容而已,没有实现用处。不过还是看一看srS.d目录:

	gavin@ubuntu:/etc/rcS.d$ ll	
	总计 20
	-rw-r--r--   1 root root   447 2009-09-07 11:58 README
	lrwxrwxrwx   1 root root    18 2010-12-07 05:27 S01apparmor -> ../init.d/apparmor*
	lrwxrwxrwx   1 root root    16 2010-12-07 05:27 S01brltty -> ../init.d/brltty*
	lrwxrwxrwx   1 root root    20 2010-12-07 05:27 S01lm-sensors -> ../init.d/lm-sensors*
	lrwxrwxrwx   1 root root    20 2010-12-07 05:27 S01x11-common -> ../init.d/x11-common*
	lrwxrwxrwx   1 root root    21 2010-12-07 05:27 S02pcmciautils -> ../init.d/pcmciautils*
	lrwxrwxrwx   1 root root    17 2010-12-07 05:27 S02urandom -> ../init.d/urandom*

所有文件都是符号链接,都指向../init.d目录中的文件 

抱歉!评论已关闭.