本节内容貌似仅限于 Gentoo Linux ....
启动脚本目录:/etc/init.d/, 然而好些启动脚本里都有使用些看起来未初始化的变量, 那么这些变量真的就没初始化吗? 非也 !
这里得谈谈另外一个神奇的目录: /etc/conf.d/ , 这里面都是些服务的配置文件,分别对应于/etc/init.d/ 里的启动脚本,而且连文件名都一样。
原来,用 /etc/init.d/ 目录里的脚本启动服务时,会先读取 /etc/conf.d/ 下的同名配置文件,完成变量的初始化。
Gentoo 服务启动脚本( /etc/init.d/* )可能会看到这个:
depend() { need net use logger dns provide mta }need 和 use 倒是可以理解,provide 又是在干嘛?
A virtual dependency is a dependency that a service provides, but that is not provided solely by that service. Your init script can depend on a system logger, but there are many system loggers available (metalogd, syslog-ng, sysklogd, ...). As you cannot need every single one of them (no sensible system has all these system loggers installed and running) we made sure that all these services provide a virtual dependency.
另外, rc-updata, rc-service, runscript, start-stop-daemon 皆链接向 /sbin/rc , 但是 rc-updata, rc-service, runscript, start-stop-daemon 这几个命令(rc命令的软链接)的功能都不同。 这又是为什么呢?
难道, 这个和 sandbox 同样的道理?
http://forums.gentoo.org/viewtopic-t-923868-highlight-.html