Search code examples
pythonjenkinsdebiandaemon

Daemonize web.py python application in Debian 6.06


I am trying to daemonize a web.py python application in debian 6.06 so that I can start / stop it with jenkins.

The most progress I have made so far is this:

root@ip-10-80-227-164:/var/lib/jenkins/workspace/beta# /sbin/start-stop-daemon 
--start --pidfile /var/tmp/betad/betad.pid --user root --group root 
--exec /usr/local/bin/python2.7 /var/lib/jenkins/workspace/beta/app.py --verbose

but that breaks all of the relative paths inside the application. I get a stack trace like

IOError: [Errno 2] No such file or directory: './somefile'

Normally I start the server with python app.py and it runs without issue.

I would love to daemonize it like pep 3143 but I don't know how I would tell it to run app.py in daemon context (the application isn't wrapped in a function I can call).

Any help would be much appreciated!


Solution

  • Following this: http://edvanbeinum.com/how-to-install-and-configure-supervisord I can easily do it with supervisord