3
# Required-Start: $local_fs $remote_fs $network
5
# Default-Stop: 0 1 2 6
6
# Short-Description: Loggerhead
7
# Description: Manage Loggerhead (a web viewer for projects in bazaar)
3
# Required-Start: $local_fs $remote_fs $network
5
# Default-Stop: 0 1 2 6
6
# Short-Description: Loggerhead
7
# Description: Manage Loggerhead (a web viewer for projects in bazaar)
10
# Configure this please: #
11
LOGGERHEAD_PATH=/opt/loggerhead
12
# Configure this please:
13
# (Please stop loggerhead before changing the configuration, otherwise this
14
# script might not be able to kill loggerhead)
17
# If serve-branches is not in your path, you will need to specify the full path:
18
SERVE_BRANCHES_CMD=serve-branches
12
20
LOG_FOLDER=/var/log/loggerhead
13
21
LOG_FILE=$LOG_FOLDER/loggerheadd.log
22
URL_PREFIX=/loggerhead
25
#please specify the base directory to serve:
17
28
# 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/"
29
START_CMD="$SERVE_BRANCHES_CMD --prefix=$URL_PREFIX --log-folder=$LOG_FOLDER --port=$PORT $BZRROOT"
37
pgrep -fl "$START_CMD"
41
proccess=`loggerhead_process`
43
listening=`netstat -nl |grep -e ":$PORT "`
45
if [ -z "$proccess" ]; then
46
echo "Loggerhead is *not* running."
48
echo "Loggerhead is running."
49
if [ -z "$listening" ]; then
50
echo "This server is *not* listening on port $PORT."
52
echo "This server is listening on port $PORT."
24
57
start_loggerhead(){
58
echo "Starting loggerhead. (See $LOG_FOLDER for details.)"
60
# make sure the log folder is created
25
63
python $START_CMD > $LOG_FILE 2>&1 &
26
echo "Started loggerhead. (See $LOG_FOLDER for details.)"
65
#wait a little while of some logging to appear
67
for i in $(seq 1 3 30); do
69
if [ -n "$log" ]; then
79
echo "Stopping loggerhead."
30
80
pkill -f "$START_CMD"
31
proccess=`pgrep -fl "$START_CMD"`
32
if [ -z "$proccess" ]; then
33
echo "Loggerhead was stopped."
45
proccess=`pgrep -fl "$START_CMD"`
47
netstat -anp |grep -e ":$PORT"
48
if [ -z "$proccess" ]; then
49
echo "Loggerhead is not running."
51
echo "Loggerhead is running."