从rc.local运行python脚本不会执行

ala*_*een 2 python linux shell ubuntu rc

我想在ubuntu 14.04LTS的启动时运行一个python脚本.

我的rc.local文件如下:

sudo /home/hduser/morey/zookeeper-3.3.6/bin/zkServer.sh start

echo"test">/home/hduser/test3

sudo /home/hduser/morey/kafka/bin/kafka-server-start.sh /home/hduser/morey/kafka/config/server.properties&

echo"test">/home/hduser/test1

/ usr/bin/python /home/hduser/morey/kafka/automate.py&

echo"test">/home/hduser/test2

退出0

除了我的python脚本之外的所有内容在运行python脚本之后甚至可以正常工作,但是python脚本似乎没有运行.我的python脚本如下

import sys
from subprocess import Popen, PIPE, STDOUT

cmd = ["sudo", "./sbt", "project java-examples", "run"]
proc = Popen(cmd, shell=False, stdout=PIPE, stdin=PIPE, stderr=STDOUT)
proc.communicate(input='1\n')
proc.stdin.close()
Run Code Online (Sandbox Code Playgroud)

如果单独执行,它的工作完全正常.

我经历了以下问题,链接

我做了很多研究,但找不到解决方案

编辑:echo语句仅用于测试目的,第二个实际命令(不考虑echo语句)启动一个继续运行的服务器,甚至python脚本启动一个在无限循环上运行的监听器,如果这是任何救命

Ser*_*sta 5

Python脚本尝试启动./sbt.你确定当前目录rc.local运行时是什么?规则始终使用系统脚本中的绝对路径