我面临以下问题。我想在 Ubuntu 11.10 系统上将 python 脚本作为服务运行(在以下链接中已经提到: Python script as linux service/daemon)
我按照上述链接中提到的步骤进行操作,但在 syslog 中收到以下错误消息:
init: script main process (21826) terminated with status 1
Jun 8 16:59:55 bilbo kernel: [263012.984531] init: script main process ended, respawning
Jun 8 16:59:55 bilbo kernel: [263013.044099] init: script main process (21827) terminated with status 1
以上两行一直在重复。
说sudo start script
,我得到以下信息:
$ sudo start script
script start/running, process 21826
以下是我script.conf
放入的内容/etc/init
:
description "Used to start python script as a service"
author "bilbo"
start on runlevel [2]
stop on runlevel [06]
exec python /home/bilbo/scripts/webserver.py
respawn
请告诉我我做错了什么?我是否也必须更改我的 python 代码?