如何添加一个服务到Debian的S运行级别?

我有下面的脚本(它确实不重要):

#!/bin/sh -e ### BEGIN INIT INFO # Provides: watchdog_early # Required-Start: udev # Required-Stop: # Default-Start: S # Default-Stop: # X-Interactive: true # Short-Description: Start watchdog early. ### END INIT INFO # Do stuff here... 

我把它插入到S运行级别调用:

 insserv watchdog_early 

链接在/etc/rcS.d中创build:

 S04watchdog_early -> ../init.d/watchdog_early 

和/etc/init.d/watchdog_early是可执行的(具有模式755)。

尽pipe如此,它并没有在启动时运行。 为什么?

发布完整的脚本。

你的shebang行“#!/ bin / sh -e”会在出错时退出。 如果在debugging输出/行运行之前满足错误条件,则不会看到它们。

或者,删除“-e”选项并重试脚本。