我已经在Python中编写了一个日志应用程序,它应该在启动时启动,但我无法使用Ubuntu的Upstart init守护程序启动应用程序.当使用sudo /usr/local/greeenlog/main.pyw从终端运行时,应用程序可以正常运行.以下是我为Upstart工作尝试的内容:
/etc/init/greeenlog.conf
# greeenlog
description "I log stuff."
start on startup
stop on shutdown
script
exec /usr/local/greeenlog/main.pyw
end script
Run Code Online (Sandbox Code Playgroud)
我的应用程序启动一个子线程,以防重要.我已经尝试了期望fork节的工作而没有任何结果的变化.我也尝试过使用sudo而没有脚本语句(只是一个单独的exec语句).在所有情况下,启动后,运行状态greeenlog返回greeenlog停止/等待并运行启动greeenlog返回:
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.61" (uid=1000 pid=2496 comm="start) interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))
Run Code Online (Sandbox Code Playgroud)
谁能看到我做错了什么?我感谢您提供的任何帮助.谢谢.