We’ve used daemontools to daemonise our TurboGears server under FreeBSD here at zettai.net. daemontools was installed, we just needed to hook into the system. Since this took a bit of time to figure out if I give some pointers then, hopefully, future TGers won’t have the same hassle. I used the lighttpd configuration for serving over port 80, it worked fine.
daemontools is a collection of tools for managing UNIX services.
supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.
There’s an overview of daemontools here, and a tutorial here.
We’ve linked our source directory from /service using
cd /service
ln -s /directory/to/src/showmedo
and inside /directory/to/src/showmedo we have a run script containing
#!/bin/sh
exec /usr/local/bin/softlimit setuidgid www python /directory/to/src/showmedo/showmedo-start.py
I also had to modify the showmedo-start.py file to include the following just after line 7’s 'import sys'
import os
os.environ['PYTHON_EGG_CACHE'] = ‘/usr/local/www/.python-eggs’
from a note here. /usr/local/www/.python-eggs has permissions 755 and is owned by www.
Let us know if this helps you out?