You are hereBlogs / David Grant's blog / init.d Script for Trac on Ubuntu Linux
init.d Script for Trac on Ubuntu Linux
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.
- David Grant's blog
- 8181 reads
thank you for sharing it, it works for me too :-)
This works just great. Thanks a lot :)
I used this script and I had to remove the -r in the DAEMON_OPTS (the port 8080 one), to make it work.
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!
Thank you for a straightforward script.
Post new comment