using THISDIR instead of WORKDIR
[feisty_meow.git] / infobase / configuration / init.d / trac_startup
1 #!/bin/bash
2 #
3 # tracd startup script by Chris Koeritz
4 #
5 #  Note that this has been superceded by the (IMHO) much better approach of
6 #  running tracd from apache using mod_python.
7 #
8 # /etc/init.d/trac_startup
9 #
10 #uhhh... chkconfig: 2345 04 11
11 # description: starts the trac daemon as the www-data user.
12 #
13 ### BEGIN INIT INFO
14 # Provides: trac_startup
15 # Required-Start:
16 # Required-Stop:
17 # Default-Start: 3 4 5
18 # Default-Stop: 0 1 2 6
19 # Short-Description: trac server initialization
20 # Description: Keeps the trac server running at our chosen port.
21 ### END INIT INFO
22
23 usage() {
24     echo "Usage: $0 {start|stop|status|kill}"
25 }
26
27 function trac_action()
28 {
29 #  export JAVA_HOME=/usr/lib/jvm/java-6-sun
30 #  export HOME=/home/buildor
31   export TRAC_PORT=24108
32   export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
33
34   # should become www-data and start trac on our port.
35   su -m -c "tracd -d -b universalbuilds.com --port $TRAC_PORT /home/trac/ubuilds_project $*" www-data
36 }
37
38 test -x ${PARSER} || exit 0 # by debian policy
39
40 case "$1" in
41         start)
42                 trac_action start
43                 rc=$?
44                 ;;
45         stop)
46                 trac_action stop
47                 rc=$?
48                 ;;
49         kill)
50                 trac_action stop kill
51                 rc=$?
52                 ;;
53         status)
54                 procs_found=$(ps wuax | grep tracd | grep -v grep)
55                 if [ -z "$procs_found" ]; then
56                   echo "tracd is not running."
57                 else
58                   echo "tracd is running."
59                 fi
60                 rc=$?
61                 ;;
62         *)
63                 usage
64                 exit 1
65                 ;;
66         esac
67 exit $rc
68
69