~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerheadd

  • Committer: Marius Kruger
  • Date: 2008-10-14 11:53:22 UTC
  • mto: This revision was merged to the branch mainline in revision 240.
  • Revision ID: amanic@gmail.com-20081014115322-d93f030tn7g7gprc
add restart

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
### BEGIN INIT INFO
 
3
# Required-Start:               $local_fs $remote_fs $network
 
4
# Default-Start:                3 5
 
5
# Default-Stop:                 0 1 2 6
 
6
# Short-Description:            Loggerhead
 
7
# Description:                  Manage Loggerhead (a web viewer for projects in bazaar)
 
8
### END INIT INFO
 
9
 
 
10
# Configure this please: #
 
11
LOGGERHEAD_PATH=/opt/loggerhead
 
12
LOG_FOLDER=/var/log/loggerhead
 
13
LOG_FILE=$LOG_FOLDER/loggerheadd.log
 
14
PREFIX=/loggerhead
 
15
PORT=8080
 
16
 
 
17
# You can add additional options to serve-branches here:
 
18
START_CMD="$LOGGERHEAD_PATH/serve-branches --prefix=$PREFIX --log-folder=$LOG_FOLDER --port=$PORT /var/lib/gforge/bzrroot/"
 
19
 
 
20
#
 
21
# main part
 
22
#
 
23
case "$1" in
 
24
    start)
 
25
        python $START_CMD > $LOG_FILE 2>&1 &
 
26
    echo "Started loggerhead.   (See $LOG_FOLDER for details.)"
 
27
    ;;
 
28
    stop)
 
29
    pkill -f "$START_CMD"
 
30
    ;;
 
31
    status)
 
32
        proccess=`pgrep -fl "$START_CMD"`
 
33
        echo "$proccess"
 
34
        netstat -anp |grep -e ":$PORT"
 
35
        if [ -z "$proccess" ]; then
 
36
        echo "Loggerhead is not running."
 
37
    restart)
 
38
        pkill -f "$START_CMD"
 
39
        python $START_CMD > $LOG_FILE 2>&1 &
 
40
        echo "Restarted loggerhead.   (See $LOG_FOLDER for details.)"
 
41
        ;;
 
42
    else
 
43
        echo "Loggerhead is running."
 
44
        fi
 
45
        ;;
 
46
    *)
 
47
        echo "Usage: loggerheadd { start | stop | status | restart }"
 
48
    exit 1
 
49
esac