aboutsummaryrefslogtreecommitdiff
path: root/src/trac/tracd
blob: 2b07fcf3465bae0041712aaca4ffced9f5059fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

. /etc/conf.d/tracd.conf
. /etc/rc.conf
. /etc/rc.d/functions

DAEMON_NAME=tracd

if [ -z "$PORT" ]; then
  PORT="-p 8080"
else
  PORT="-p $PORT"
fi

if [ -z "$AUTH" ]; then
  AUTH=
else
  AUTH="--auth ${AUTH//;/ --auth }"
fi

case "$1" in
  start)
    if [ -z "$PROJECT" ]; then
      echo "You need to set the project path in /etc/conf.d/${DAEMON_NAME}.conf"
      exit 1
    fi
    stat_busy "Starting $DAEMON_NAME: "
    tracd -d $HOSTNAME $PORT $AUTH $PROJECT
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon $DAEMON_NAME
      stat_done
    fi
    ;;
  stop)
    stat_busy "Shutting down $DAEMON_NAME: "
    kill `ps ax|grep pyth|grep tracd|awk -- "{print \\$1;}"`
    rm_daemon $DAEMON_NAME
    stat_done
    ;;
  reload|restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|reload}"
esac