Code

*** empty log message ***
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sun, 11 May 2003 12:18:39 +0000 (12:18 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sun, 11 May 2003 12:18:39 +0000 (12:18 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1713 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
TODO.txt
scripts/server-ctl [new file with mode: 0755]

index 75d2a00a41f0cee0a8a2625e3ddf22cc46c7a0af..a06d2bad146f51e34aa7915d95258ba81ff09637 100644 (file)
@@ -2,6 +2,10 @@ This file contains the changes to the Roundup system over time. The entries
 are given with the most recent entry first.
 
 2003-05-?? 0.6.0
+Feature:
+- added the start/stop/restart/condstart/status roundup-server control
+  script
+
 Fixed:
 - handle non-existant demo dir (thanks Ollie Rutherfurd)
 - strip whitespace from Role names so "User, Admin" will work
index bdf6c7d3513a3b7284656a2b1e2e9f12b22f7405..adff07ec1c04eff19ba00e8462470fd04c63046b 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -34,7 +34,6 @@ pending web       search "refinement" - pre-fill the search page with the
 pending web       multilink item removal action with retirement
 pending web       implement a python dict version of the form values
 pending web       implement the request.url attribute?
-pending web       UNIX init.d script for roundup-server
 
 bug     hyperdb   need unit tests for firing of auditors and reactors
 ======= ========= =============================================================
diff --git a/scripts/server-ctl b/scripts/server-ctl
new file mode 100755 (executable)
index 0000000..61ebf97
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+#
+# Configuration
+# 
+PORT=8080
+PIDFILE="/usr/local/roundup/var/roundup-server.pid"
+LOGFILE="/usr/local/roundup/var/roundup-server.log"
+OTHERARGS=""
+TRACKERS="cg=/usr/local/roundup/trackers/cg"
+
+SERVER="/usr/local/bin/roundup-server -l ${LOGFILE} -d ${PIDFILE} -p ${PORT} ${OTHERARGS} ${TRACKERS}"
+ERROR=0
+ARGV="$@"
+if [ "x$ARGV" = "x" ] ; then 
+    ARGS="help"
+fi
+
+for ARG in $@ $ARGS
+do
+    # check for pidfile
+    if [ -f $PIDFILE ] ; then
+       PID=`cat $PIDFILE`
+       if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+           STATUS="roundup-server (pid $PID) running"
+           RUNNING=1
+       else
+           STATUS="roundup-server (pid $PID?) not running"
+           RUNNING=0
+       fi
+    else
+       STATUS="roundup-server (no pid file) not running"
+       RUNNING=0
+    fi
+
+    case $ARG in
+    start)
+       if [ $RUNNING -eq 1 ] ; then
+           echo "$0 $ARG: roundup-server (pid $PID) already running"
+           continue
+       fi
+       if $SERVER ; then
+           echo "$0 $ARG: roundup-server started"
+       else
+           echo "$0 $ARG: roundup-server could not be started"
+           ERROR=1
+       fi
+       ;;
+    condstart)
+       if [ $RUNNING -eq 1 ] ; then
+           continue
+       fi
+       if $SERVER ; then
+           echo "$0 $ARG: roundup-server started"
+       else
+           echo "$0 $ARG: roundup-server could not be started"
+           ERROR=1
+       fi
+       ;;
+    stop)
+       if [ $RUNNING -eq 0 ] ; then
+           echo "$0 $ARG: $STATUS"
+           continue
+       fi
+       if kill $PID ; then
+           echo "$0 $ARG: roundup-server stopped"
+       else
+           echo "$0 $ARG: roundup-server could not be stopped"
+           ERROR=2
+       fi
+       ;;
+    status)
+       echo $STATUS
+       ;;
+    *)
+       echo "usage: $0 (start|condstart|stop|status)"
+       cat <<EOF
+
+    start      - start roundup-server
+    condstart  - start roundup-server if it's not running
+    stop       - stop roundup-server
+    status     - display roundup-server status
+
+EOF
+       ERROR=3
+    ;;
+
+    esac
+
+done
+
+exit $ERROR
+