RK3399 /etc/init.d目录下的开机自启脚本

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

1.进入/etc/init.d/文件下

cd /etc/init.d/

2.创建test.sh文件

cat /etc/init.d/test.sh

3.修改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
/usr/bin/python3 /home/firefly/python/server.py        //开机后需要执行的命令

4.赋权限给test.sh脚本文件

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

5.加入开机启动

sudo update-rc.d /etc/init.d/test.sh defaults 99   //在ubuntu环境认可的命令,如果出现,请进入到/etc/init.d目录执行update-rc.d的命令。

如果报错如下

update-rc.d: error: unable to read /etc/init.d//etc/init.d/test.sh

执行

cd /etc/init.d/
sudo update-rc.d /etc/init.d/test.sh defaults 99

6.判断test.sh是否能正常开机运行

cd /etc/init.d/
bash test.sh

修改报错,确保第6步能正常运行

7.  重启验证
  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值