Python script as a service on Ubuntu 11.10
- by bugs99
I am facing the following problem. I want to run a python script as a service on Ubuntu 11.10 system (already mentioned in the following link:
Python service using Upstart on Ubuntu)
I followed the steps mentioned in the above mentioned link, but i got the following error message in 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
The above two lines are getting repeated all the time.
On saying sudo start script, I get the following:
$ sudo start script
script start/running, process 21826
Following is the content of my script.conf placed in /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
Please tell me what I am doing wrong? Do I have to change my python code as well?