Ubuntu开机启动自定义脚本,命令

1、进入etc/init.d

创建test.sh编辑

本例子,主要,开机创建opt/test文件。
#!/bin/sh
### BEGIN INIT INFO
# Provides:             start_test.sh
# Required-Start:       $all
# Required-Stop:        $all
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    starts the  start_test.sh
# Description:          starts  start_test.sh
#                       for security.
### END INIT INFO

mkdir /opt/test
  

2、sudo chmod +x test.sh

sudo update-rc.d start_test.sh defaults 90

猜你喜欢

转载自blog.csdn.net/xiaohanshasha/article/details/81777544