首页 > 系统服务 > 详细

linux系统/etc/init.d目录下的开机自启脚本

时间:2021-05-06 09:38:55      阅读:28      评论:0      收藏:0      [点我收藏+]

https://www.cnblogs.com/liusingbon/p/13037735.html

1.复制或软连接脚本到/etc/init.d/目录下

2.脚本内容如下,加粗内容是模板性注释,不能更改。

$cat /etc/init.d/test.sh

#!/bin/bash

### BEGIN INIT INFO

# Provides:          test.sh        //test.sh是自己创建的脚本名称

# Required-Start:    $local_fs $network $remote_fs $syslog

# Required-Stop:     $local_fs $network $remote_fs $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: starts the test.sh daemon      //test.sh是自己创建的脚本名称

# Description:       starts test.sh using start-stop-daemon     //test.sh是自己创建的脚本名称

### END INIT INFO

sudo cp /media/share/frp_0.27.0_linux_amd64.tar.gz /opt/        //开机后需要执行的命令

3.赋权限给脚本文件

$sudo chmod 755 /etc/init.d/test.sh

4.加入开机启动

$sudo update-rc.d /etc/init.d/test.sh defaults 90

5.重启验证

结束。

linux系统/etc/init.d目录下的开机自启脚本

原文:https://www.cnblogs.com/chinasoft/p/14733336.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!