views:

503

answers:

1

I've followed the basic CherryPy tutorial (http://www.cherrypy.org/wiki/CherryPyTutorial). One thing not discussed is deployment.

How can I launch a CherryPy app as a daemon and "forget about it"? What happens if the server reboots?

Is there a standard recipe? Maybe something that will create a service script (/etc/init.d/cherrypy...)

Thanks!

+1  A: 

There is a Daemonizer plugin for CherryPy included by default which is useful for getting it to start but by far the easiest way for simple cases is to use the cherryd script:

> cherryd -h
Usage: cherryd [options]

Options:
  -h, --help            show this help message and exit
  -c CONFIG, --config=CONFIG
                        specify config file(s)
  -d                    run the server as a daemon
  -e ENVIRONMENT, --environment=ENVIRONMENT
                        apply the given config environment
  -f                    start a fastcgi server instead of the default HTTP
                        server
  -s                    start a scgi server instead of the default HTTP server
  -i IMPORTS, --import=IMPORTS
                        specify modules to import
  -p PIDFILE, --pidfile=PIDFILE
                        store the process id in the given file

As far as an init.d script goes I think there are examples that can be Googled.

Benno