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

我自己需要开机运行一个脚本,按照网上的说法,修改了/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/bash

cd /home/guest/myproject 
echo "I am running" > ooooo.txt
nohup ./server | tee server_run.log

重启之后也没有出现ooooo.txt,说明这个脚本没有执行

吃鸡游戏
浏览 230回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP