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
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/sh
### BEGIN INIT INFO
# Required-Start: $local_fs $remote_fs $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Loggerhead
# Description: Manage Loggerhead (a web viewer for projects in bazaar)
### END INIT INFO
# Configure this please: #
LOGGERHEAD_PATH=/opt/loggerhead
LOG_FOLDER=/var/log/loggerhead
LOG_FILE=$LOG_FOLDER/loggerheadd.log
PREFIX=/loggerhead
PORT=8080
# You can add additional options to serve-branches here:
START_CMD="$LOGGERHEAD_PATH/serve-branches --prefix=$PREFIX --log-folder=$LOG_FOLDER --port=$PORT /var/lib/gforge/bzrroot/"
#
# main part
#
start_loggerhead(){
python $START_CMD > $LOG_FILE 2>&1 &
echo "Started loggerhead. (See $LOG_FOLDER for details.)"
}
stop_loggerhead(){
pkill -f "$START_CMD"
proccess=`pgrep -fl "$START_CMD"`
if [ -z "$proccess" ]; then
echo "Loggerhead was stopped."
fi
}
case "$1" in
start)
start_loggerhead
;;
stop)
stop_loggerhead
;;
status)
proccess=`pgrep -fl "$START_CMD"`
echo "$proccess"
netstat -anp |grep -e ":$PORT"
if [ -z "$proccess" ]; then
echo "Loggerhead is not running."
else
echo "Loggerhead is running."
fi
;;
restart)
stop_loggerhead
start_loggerhead
;;
*)
echo "Usage: loggerheadd { start | stop | status | restart }"
exit 1
esac
|