I use Trac for the Open Yahtzee website. I’ve decided to use tracd
for serving the requests (due to a configuration issue I didn’t want to mess with), which required starting it each time the server restarts. I’ve already written one solution for it, in the form of an init.d
script for tracd
. However, it bothered me that the tracd
runs with root privileges which it doesn’t really requires.
After searching a bit I’ve found out that cron
can run tasks on startup using the special @reboot
keyword instead of the normal time fields. So edit your crontab and add the following line:
@reboot /usr/bin/tracd --daemonize --pidfile=~/run/tracd.pid --port=PORT --hostname=HOSTNAME -s TRAC_ENV
Just replace PORT
, HOSTNAME
and TRAC_ENV
with the appropriate values for your environment, and make sure you got a run/
sub-directory in your home folder (or change the pidfile value).
To stop the server just do:
kill `cat ~/run/tracd.pid`
While there is no straight way to restart the server (like /etc/init.d/tracd restart
), it’s a good compromise for dropping root privileges.