我写好脚本后放到了 /etc/init.d/ 但是用 update-rc.d test.sh start 99 命令注册到启动的时后报如下错误:
insserv: warning: script 'test.sh' missing LSB tags and overrides
insserv: There is a loop between service monit and test.sh if stopped
insserv: loop involving service test.sh at depth 2
insserv: loop involving service monit at depth 1
insserv: Stopping test.sh depends on monit and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
解决办法在 test.sh 脚本前面加上,关于 LSB 配置详细信息:
#!/bin/bash
### BEGIN INIT INFO
# Provides: test
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts test
# Description: starts the test
### END INIT INFO
echo 'Hello World'