Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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: http://stackoverflow.com/questions/4705564/python-script-as-linux-service-daemon/10948190#10948190)

Query is marked as closed there. Thats why posting it here now.

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

Please tell me what I am doing wrong? Do I have to change my python code as well?

share|improve this question
This may help you stackoverflow.com/questions/1984847/… –  Hex Jun 11 '12 at 8:24
Was able to solve it. Just add chdir /home/bilbo/scripts above exec statement. change exec statement to exec python webserver.py That was it. :) –  bugs99 Jun 12 '12 at 6:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.