为了账号安全,请及时绑定邮箱和手机立即绑定

该如何使用linux系统开机启动自己写的脚本?

该如何使用linux系统开机启动自己写的脚本?

吃鸡游戏 2021-10-14 21:11:55
我自己需要开机运行一个脚本,按照网上的说法,修改了/etc/rc.local root#cat /etc/rc.local#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/home/guest/myproject/autorun.sh最后一行是我加进去的自己的脚本路径,但是不起作用,开机还是无法自己启动,谁知道为什么吗?手动自己执行这个脚本是可以的。脚本可读可写可执行,脚本内容:[root@Medea.zx.nicx.cn myproject]# pwd/home/guest/myproject[root@Medea.zx.nicx.cn myproject]# cat autorun.sh #!/bin/bashcd /home/guest/myproject echo "I am running" > ooooo.txtnohup ./server | tee server_run.log重启之后也没有出现ooooo.txt,说明这个脚本没有执行
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 226 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信