I modified an nginx init.d script and created an init.d script for trac.d. I run tracd and then forward traffic from trac.davidgrant.ca to trac's port (using nginx) rather than using cgi or fast-cgi. Please let me know if you have any problems with this scripts and I will fix it.
#! /bin/sh ### BEGIN INIT INFO # Provides: tracd # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the tracd web server # Description: starts tracd using start-stop-daemon ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/tracd NAME=tracd DESC=tracd #DAEMON_OPTS="-s -r -d -p 8080 --basic-auth=*,/etc/tracd/tracusers,trac /trac" DAEMON_OPTS="-s -d -p 8000 /home/david/trac --pidfile /var/run/$NAME.pid" test -x $DAEMON || exit 0 # Include tracd defaults if available if [ -f /etc/default/tracd ] ; then . /etc/default/tracd fi set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile \ /var/run/$NAME.pid sleep 1 start-stop-daemon --start --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0
After you create the script at /etc/init.d/tracd
, don't forget to do the following:
sudo chmod +x /etc/init.d/tracd sudo /usr/sbin/update-rc.d -f tracd defaults
to make the script executable and to make it run on startup.
Comments
motumboe (not verified)
Thu, 2008-12-11 23:16
Permalink
thanks :-)
thank you for sharing it, it works for me too :-)
manat (not verified)
Thu, 2008-12-18 20:00
Permalink
Thanks!
This works just great. Thanks a lot :)
Anonymous (not verified)
Wed, 2011-07-06 12:02
Permalink
Thanks
I used this script and I had to remove the -r in the DAEMON_OPTS (the port 8080 one), to make it work.
ptecza (not verified)
Fri, 2011-12-02 04:14
Permalink
It's just a script I was
It's just a script I was looking for, because I'm too lazy admin to write it myself ;) Of course I need to do some customization, for example add a dependency on Nginx, but it's a great start point for me. Thank you very much, David!
Anonymous (not verified)
Sat, 2011-12-31 11:22
Permalink
Thanks!
Thank you for a straightforward script.
Scott Grodberg (not verified)
Sun, 2013-10-27 17:06
Permalink
Nice One
Ubuntu 12.04 here, had to change executable path from /usr/bin/tracd to /usr/local/bin/tracd and hack up my own DAEMON_OPTS but you made it easy for me -- Thank you so much David!
Add new comment