Option -f Force removal of symlinks even if /etc/init.d/name still exists.(相当于就算/etc/init.d/下还存在apache脚本,但是/etc/rcX.d/下所有关于apache2的软链接均被删除)

Adding A Service
Default Priorities
Now, if you want to re-add your service to be started on boot up, you can simply use:

Specifying Custom Runlevels

我的一个init.d启动脚本样例
wangzhengyi@cloud-1:/etc/init.d$ cat writelog
#!/bin/sh
### BEGIN INIT INFO
# Provides: wzy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: test update-rc.d to start a service
### END INIT INF
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
DESC="write log daemon"
SCRIPTNAME="/home/wangzhengyi/scripts/ceshi.sh"
export PATH=$PATH
. /lib/lsb/init-functions
do_start() {
log_begin_msg "Runing wzy writeing log scripts $SCRIPTNAME"
if [ -x $SCRIPTNAME ]; then
$SCRIPTNAME
ES=$?
fi
log_end_msg $ES
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload|staus)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
exit 0
