宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页
  2. 学无止境
  3. 正文

centos7 添加开机自启动sh脚本

2019年1月5日 468点热度 0人点赞 0条评论

1.添加开机自启脚本

脚本路径和内容试自己情况而定,下面是示例sh内容

#!/bin/bash

nohup /webapps/frp/frps -c /webapps/frp/frps.ini &

2.赋予脚本可执行权限

chmod +x /webapps/shell/autostart.sh

3.打开/etc/rc.d/rc.local文件,在末尾增加如下内容

echo "/webapps/shell/autostart.sh >/webapps/shell/log.log 2>&1" >> /etc/rc.d/rc.local

或者使用vi/vim编辑器,在末尾追加

vi /etc/rc.d/rc.local

4.赋予/etc/rc.d/rc.local的执行权限

在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限

chmod +x /etc/rc.d/rc.local

作者:hold

链接:https://juejin.im/post/5cbd1a3ae51d456e336cd4ac

来源:掘金

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

标签: 暂无
最后更新:2019年1月5日

小渔民

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2