1

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: https://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
respawn

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

bugs99
  • 15
  • 1
  • 8
  • This may help you http://stackoverflow.com/questions/1984847/need-init-d-script-for-python-application – Hex Jun 11 '12 at 08: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 06:43

0 Answers0