脚本stunserver,内容如下:
#!/bin/bash
# /home/bakup/Desktop/stunserver/stunserver
### BEGIN INIT INFO
# Provides: newayte
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop stunserver
### END INIT INFO
EXEC_FILE=stunserver
EXEC_PATH=/home/bakup/Desktop/stunserver/$EXEC_FILE
case "$1" in
start)
start-stop-daemon --start --background --exec $EXEC_PATH
;;
stop)
start-stop-daemon --stop --name $EXEC_FILE
esac
复制到/etc/init.d
chmod 755 stunserver
update-rc.d stunserver defaults 99
即可。
删除:
update-rc.d -f stunserver remove