我正在运行Debian 6.0,我正在尝试在启动时使用一个非常简单的init脚本。
我正在运行以下命令:
$ cd /etc/init.d
$ pico script
#! /bin/sh
### BEGIN INIT INFO
# Provides: script
# 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 script.
### END INIT INFO
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH="$PATH:/usr/local/bin"
DESC="script..."
NAME=script
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Some things that run always
echo "Welcome!!!!!" | tee /$HOME/hello.txt
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script blah "
echo "Could do more here"
;;
stop)
echo "Stopping script blah"
echo "Could do more here"
;;
reload)
echo "reload"
;;
*)
echo "Usage: /etc/init.d/blah {start|stop}"
exit 1
;;
esac
exit 0
$ chmod 755脚本
$ chown root:root script
$ insserv脚本
确实使用./script start。但它不是在启动时。
**我使用 insserv 而不是 update-rc.d ,因为我收到此错误:
" update-rc.d:使用基于依赖关系的启动顺序"
我错过了什么? =(