Saturday, 1 June 2013

how to start python server using upstart

how to start python server using upstart

When I run initctl start my-service the shell just hangs, and the web.py is not running.
web.py doesnt fork or anything, hence the use of start-stop-daemon.
I also notice that the pidfile doesnt get created. Maybe thats just because it hasnt started.
description "Run the server"

env USER=user1
env GROUP=user1
env HOME=/home/user1/projects/server

start on runlevel [2345]
stop on runlevel [06]

expect daemon
exec start-stop-daemon --pidfile ${HOME}/RUNNING_PID --chuid $USER:$GROUP -d ${HOME} --exec ${HOME}/web.py --background --start 
How do I configure upstart and start-stop-daemon to start web.py as a service? Thanks.

No comments:

Post a Comment