starting Turbogears apps automatically under Gentoo

Thanks to some little scripts for Gentoo by Dennis Muhlestein you can start your TurboGears applications automatically at system’s startup under Gentoo. In case you’re too lazy to read his entry, here is what to do (enriched by my ideas):
- create a init.d template in
/etc/init.das follows, name it cherrypy and grant execute rights to everyone:#!/sbin/runscript depend() { need net } start() { su -l $APPUSER -c "screen -S $SESS_NAME -d -m $APP_DIR/$SCRIPT_NAME" } stop() { su -l $APPUSER -c "screen -S $SESS_NAME -X kill" } - make a link to it, naming it similar to your application
ln -s cherrypy hsyssite
- create a configuration file in
/etc/conf.dfor this application with following settings:APPUSER="mark" APP_DIR="/home/mark/WebApps/HsysSite" SESS_NAME="hsyssite" SCRIPT_NAME="start.sh"
- put that start-script in the application’s directory (named start.sh):
#!/bin/bash #PATH=/home/the_user/bin:$PATH cd `dirname $0` ./start-hsyssite.py prod.cfg
- don’t forget to add it to the default runlevel!
rc-update add hsyssite default
Thank you, Dennis!
