rc脚本依赖关系

在Ubuntu 10.04.1 LTS服务器上安装某些服务后重启后无法正常启动

我在eth0上定义了几个虚拟接口:

的/ etc /networking/接口

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 172.16.5.240 netmask 255.255.255.0 gateway 172.16.5.1 auto eth0:1 iface eth0:1 inet static address 172.16.5.241 netmask 255.255.255.0 gateway 172.16.5.1 auto eth0:2 iface eth0:2 inet static address 172.16.5.242 netmask 255.255.255.0 gateway 172.16.5.1 auto eth0:3 iface eth0:3 inet static address 172.16.5.243 netmask 255.255.255.0 gateway 172.16.5.1 

等等…

一些尝试绑定到例如172.16.5.243的SysV init脚本在启动过程中失败,抱怨说没有这样的IP地址。

我的问题:

1)服务是否默认启动? 我可以禁用,所以他们顺序运行?

2)有没有一种方法来定义rc脚本之间的依赖关系? 我只熟悉使用/etc/rc[0-6].d/中的数字来定义启动脚本的顺序,

任何其他修补程序或解决方法赞赏。

你的问题没有明确的答案。 这取决于需要172.16.5.243的服务是SysV初始化脚本还是新贵作业。

当它是一个SysV初始化脚本时,你可以在init脚本中添加这个头文件的依赖关系:

 ### BEGIN INIT INFO # Provides: scriptname # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO 

当它是一个Upstart脚本,看看这个职位 。 有趣的部分是在接受的答案:

 start on (local-filesystems and net-device-up IFACE=eth0)