Debian 创建开机自启动脚本
Debian 使用update-rc.d
添加开机自启动脚本
## 进入开机启动目录
cd /etc/init.d
## 创建开机启动脚本
touch xx.sh
## 赋予执行权限
chmod +x /etc/init.d/xx.sh
#设置开机自启
update-rc.d xx.sh defaults
可能会报错,缺少必填项
insserv: warning: script 'xx.sh' missing LSB tags
insserv: warning: script 'xx.sh' missing LSB tags
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `xx.sh'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `xx.sh'
在脚本最前面添加必填项,参数说明:LSBInitScripts
#!/bin/sh
### BEGIN INIT INFO
# Provides: xx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts xx
# Description: starts the xx
### END INIT INFO