新手问题,对不起 – 我一直在谷歌search“重新启动ubuntu自动启动”之类的,但我不知道我find了确定的答案。
我正在使用Ubuntu 10.04,并且我想确保每当服务器重启时心跳都会自动启动。
目前我正在手动运行以下内容:
$ /etc/init.d/heartbeat start
如何确保在服务器重新启动时调用?
我用Googlesearch的一个答案是:
$ update-rc.d heartbeat defaults
会做的伎俩 – 是正确的?
inputupdate-rc.d heartbeat defaults
它会在重启后自动启动
如果你想closures它,请input“update-rc.d -f heartbeat remove”
这应该。 基本上,启动过程实际上并不在/etc/init.d中查找,它在/etc/rc2.d(或定义为启动运行级别)中查找。 /etc/rc2.d中的文件应该是/etc/init.d中的文件的符号链接:
$ ls -l /etc/rc2.d total 4 lrwxrwxrwx 1 root root 14 Sep 19 14:13 K16nsca -> ../init.d/nsca -rw-r--r-- 1 root root 677 Mar 30 2011 README lrwxrwxrwx 1 root root 19 Aug 15 17:30 S10syslog-ng -> ../init.d/syslog-ng lrwxrwxrwx 1 root root 23 Jul 6 20:18 S20chef-expander -> ../init.d/chef-expander lrwxrwxrwx 1 root root 19 Jun 30 19:46 S20chef-solr -> ../init.d/chef-solr lrwxrwxrwx 1 root root 17 Jun 30 19:46 S20couchdb -> ../init.d/couchdb lrwxrwxrwx 1 root root 20 Jul 22 16:20 S20fancontrol -> ../init.d/fancontrol lrwxrwxrwx 1 root root 15 Jun 30 19:46 S20jetty -> ../init.d/jetty lrwxrwxrwx 1 root root 28 Jul 22 16:20 S20nagios-nrpe-server -> ../init.d/nagios-nrpe-server
等等。
为了在启动时启动Heartbeat,它应该有一个符号链接。
您可以手动创build这些链接,但Ubuntu使用update-rc.d命令来pipe理这些符号链接,因此您不必这样做。
由于/etc/rc2.d目录是root拥有和许可的,您将需要实际运行:
$ sudo update-rc.d heartbeat defaults
以超级用户权限运行该命令。 运行时,它应该显示它将创build的一组符号链接。 除了/etc/rc2.d之外,它应该在其他/etc/rc?.d目录中放置类似的链接,包括/etc/rc6.d中的链接(例如)closures服务盒子closures了。
尝试再次运行脚本,一些脚本只是说,他们开始,不要抱怨。 另外,如果我没有错,你在做什么是说这个脚本运行心跳,但你没有给脚本任何参数。 (如果我正确理解这个页面 )
你可以做一个名为foo的脚本:
/etc/init.d/heartbeat start
使其可执行与chmod + x
然后运行命令update-rc.d foo defaults
它将在启动时运行foo脚本中的所有命令。