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)
12
# Configure this please:
13
# (Please stop loggerhead before changing the configuration, otherwise this
14
# script might not be able to kill loggerhead)
19
if [ `whoami` = "$LHUSER" ]; then
22
SUDO="sudo -H -u $LHUSER"
25
# If serve-branches is not in your path, you will need to specify the full path:
26
SERVE_BRANCHES_CMD=serve-branches
10
# Configure this please: #
11
LOGGERHEAD_PATH=/opt/loggerhead
28
12
LOG_FOLDER=/var/log/loggerhead
29
13
LOG_FILE=$LOG_FOLDER/loggerheadd.log
30
URL_PREFIX=/loggerhead
33
#please specify the base directory to serve:
36
17
# You can add additional options to serve-branches here:
37
START_CMD="$SERVE_BRANCHES_CMD --prefix=$URL_PREFIX --log-folder=$LOG_FOLDER --port=$PORT $BZRROOT"
18
START_CMD="$LOGGERHEAD_PATH/serve-branches --prefix=$PREFIX --log-folder=$LOG_FOLDER --port=$PORT /var/lib/gforge/bzrroot/"
45
$SUDO pgrep -fl "$START_CMD"
49
proccess=`loggerhead_process`
51
listening=`netstat -nl |grep -e ":$PORT "`
53
if [ -z "$proccess" ]; then
54
echo "Loggerhead is *not* running."
56
echo "Loggerhead is running."
57
if [ -z "$listening" ]; then
58
echo "This server is *not* listening on port $PORT."
60
echo "This server is listening on port $PORT."
65
24
start_loggerhead(){
66
echo "Starting loggerhead. (See $LOG_FOLDER for details.)"
68
# make sure the log folder is created
69
if [ ! -d $LOG_FOLDER ]
71
$SUDO mkdir -p $LOG_FOLDER
74
$SUDO python $START_CMD > $LOG_FILE 2>&1 &
76
#wait a little while of some logging to appear
78
for i in $(seq 1 3 30); do
80
if [ -n "$log" ]; then
25
python $START_CMD > $LOG_FILE 2>&1 &
26
echo "Started loggerhead. (See $LOG_FOLDER for details.)"
90
echo "Stopping loggerhead."
91
$SUDO pkill -f "$START_CMD"
31
proccess=`pgrep -fl "$START_CMD"`
32
if [ -z "$proccess" ]; then
33
echo "Loggerhead was stopped."