• 示例代码

[codesyntax lang="php"]


#!/bin/sh
### BEGIN INIT INFO
# Provides: surenpi
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Should-Start: suren
# Should-Stop: suren
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: http://surenpi.com
# Description: http://surenpi.com
### END INIT INFO

case $1 in
start)
echo "start"
;;
stop)
echo "stop"
;;
*)
echo "Usage: $0 (start|stop)"
;;
esac


[/codesyntax]

  • 开机启动服务

update-rc.d suren defaults

update-rc.d suren remove

参考

​你知道Linux下的目录结构是什么样子的吗?请看这里。​​​