Ubuntu自启动设置

ubuntu中编写shell脚本开机自动启动(推荐)_Linux_脚本之家

1. vim test.sh

2.

 #!/bin/bash

### BEGIN INIT INFO
# Provides:     test
# Required-Start:  $remote_fs $syslog
# Required-Stop:   $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:   0 1 6
# Short-Description: start test
# Description:    start test
### END INIT INFO

#此处编写脚本内容
cd /home/Desktop/
./test.sh
exit 0

3. 移动文件

sudo mv test.sh /etc/init.d/

4. 给文件增加权限

chmod +750 test.sh

5. 设置开机自动启动

sudo update-rc.d test.sh defaults

6.Ubuntu自启动设置_第1张图片

你可能感兴趣的:(ubuntu,1024程序员节)