Linux系统【Ubuntu】开机自启脚本及配置
1、使用vim命令在/etc/init.d
目录下新建一个xx.sh,文件名可自定义,以test.sh为例
vim /etc/init.d/test.sh
也可以用 touch test.sh
命令创建文件
复制代码:
#!/bin/sh
### BEGIN INIT INFO
# Provides: test.sh
# Required-start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the test.sh daemon
# Description: starts test.sh using start-stop-daemon
### END INIT INFO