linux下/etc/rc.d/rc.local中的命令没执行是什么原因

#!/bin/bash## 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/bin/echo $PATH>/opt/java/path.txtsource /etc/profile/bin/echo $PATH>>/opt/java/path.txt/bin/echo "i am liyuan ">/opt/java/test.txtnohup java -jar JavaBridge.jar SERVLET_LOCAL:9090>/dev/null 2>&1 &~这是rc.local文件。最后一条命令开机后没执行,开机后我运行/etc/rc.d/rc.local 其中最后的nohup命令是可以执行的,我是了其他命令,遇到nohup命令都不能执行,是不是nohup这个命令的原因?求解,求大神指导,谢谢了。
上面的格式乱的代码不用看
#!/bin/bash
#
# 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
/bin/echo $PATH>/opt/java/path.txt
source /etc/profile
/bin/echo $PATH>>/opt/java/path.txt
/bin/echo "i am liyuan ">/opt/java/test.txt
nohup java -jar JavaBridge.jar SERVLET_LOCAL:9090>/dev/null 2>&1 &

补充rc.local 文件

第1个回答  2014-05-06
如果没有执行成功, 那就是要看执行的命令或者是脚本是什么样子的了
如果shell写错了, 那肯定不行的啊。
可以帮楼主排查一下这个问题。
以后要是遇到了Linux服务器系统方面的问题, 都可以帮忙解决!
第2个回答  2018-05-08
打出来日志看看报错,一般不执行都是环境变量的问题
第3个回答  2018-05-08
有可能是rc.local 文件权限没改,要改成可执行才可以