使用upstart在ubuntu上运行Python服务

使用upstart在ubuntu上运行Python服务,ubuntu,service,heartbeat,upstart,Ubuntu,Service,Heartbeat,Upstart,我想创建一个heartbeat服务(一个python脚本),并使用Upstart将其部署为服务 我的理解是,我必须添加一个包含以下内容的/etc/init/myheartbeatservice.conf # my heartbeat service description "Heartbeat monitor" start on startup stop on shutdown script exec /path/to/my/python/script.py end sc

我想创建一个heartbeat服务(一个python脚本),并使用Upstart将其部署为服务

我的理解是,我必须添加一个包含以下内容的
/etc/init/myheartbeatservice.conf

# my heartbeat service 

description     "Heartbeat monitor"

start on startup
stop on shutdown

script
    exec /path/to/my/python/script.py
end script 
我的脚本启动另一个服务进程,并监视这些进程,并定期向外部服务器发送心跳信号。
启动
关闭
事件是否正确? 我的脚本还创建了一个新线程。我假设我还需要将
fork daemon
添加到我的conf文件中


谢谢

Upstart只设置少数几个环境变量。您的应用程序是否需要这些集合中的任何一个

请参见对类似问题的回答: