我在我的Amazon AWS AMI上修改了/etc/rc.local
#!/bin/sh touch /var/lock/subsys/local # setup hostname properly /usr/bin/python /root/automation/initSystem.py
所以最后一行调用configuration(Envvariables,主机名,networking设置等)的Python脚本,然后执行/etc/init.d/network restart
如果我手动运行rc.local /etc/rc.local一切都很好
系统自动启动时不起作用。 所以触摸命令(第二行 – 工作),但从未执行python脚本,至less它的执行结果(设置主机名和重新启动networking界面似乎根本不工作)
有任何想法吗?
我们无法debugging一个神秘的脚本。 运行python脚本是否在空白环境下工作? 尝试:
env -i /usr/bin/python /root/automation/initSystem.py
修改脚本以在脚本中捕获命令的输出:
/usr/bin/python /root/automation/initSystem.py > /root/init.stdout 2> /root/init.stderr
它可能会包含提示为什么失败。