Mercurial > p > roundup > code
comparison scripts/server-ctl @ 1646:adc076b825a1
*** empty log message ***
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 11 May 2003 12:18:39 +0000 |
| parents | |
| children | 311ad623e2d1 |
comparison
equal
deleted
inserted
replaced
| 1645:ccabdc2055cf | 1646:adc076b825a1 |
|---|---|
| 1 #!/bin/sh | |
| 2 | |
| 3 # | |
| 4 # Configuration | |
| 5 # | |
| 6 PORT=8080 | |
| 7 PIDFILE="/usr/local/roundup/var/roundup-server.pid" | |
| 8 LOGFILE="/usr/local/roundup/var/roundup-server.log" | |
| 9 OTHERARGS="" | |
| 10 TRACKERS="cg=/usr/local/roundup/trackers/cg" | |
| 11 | |
| 12 SERVER="/usr/local/bin/roundup-server -l ${LOGFILE} -d ${PIDFILE} -p ${PORT} ${OTHERARGS} ${TRACKERS}" | |
| 13 ERROR=0 | |
| 14 ARGV="$@" | |
| 15 if [ "x$ARGV" = "x" ] ; then | |
| 16 ARGS="help" | |
| 17 fi | |
| 18 | |
| 19 for ARG in $@ $ARGS | |
| 20 do | |
| 21 # check for pidfile | |
| 22 if [ -f $PIDFILE ] ; then | |
| 23 PID=`cat $PIDFILE` | |
| 24 if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then | |
| 25 STATUS="roundup-server (pid $PID) running" | |
| 26 RUNNING=1 | |
| 27 else | |
| 28 STATUS="roundup-server (pid $PID?) not running" | |
| 29 RUNNING=0 | |
| 30 fi | |
| 31 else | |
| 32 STATUS="roundup-server (no pid file) not running" | |
| 33 RUNNING=0 | |
| 34 fi | |
| 35 | |
| 36 case $ARG in | |
| 37 start) | |
| 38 if [ $RUNNING -eq 1 ] ; then | |
| 39 echo "$0 $ARG: roundup-server (pid $PID) already running" | |
| 40 continue | |
| 41 fi | |
| 42 if $SERVER ; then | |
| 43 echo "$0 $ARG: roundup-server started" | |
| 44 else | |
| 45 echo "$0 $ARG: roundup-server could not be started" | |
| 46 ERROR=1 | |
| 47 fi | |
| 48 ;; | |
| 49 condstart) | |
| 50 if [ $RUNNING -eq 1 ] ; then | |
| 51 continue | |
| 52 fi | |
| 53 if $SERVER ; then | |
| 54 echo "$0 $ARG: roundup-server started" | |
| 55 else | |
| 56 echo "$0 $ARG: roundup-server could not be started" | |
| 57 ERROR=1 | |
| 58 fi | |
| 59 ;; | |
| 60 stop) | |
| 61 if [ $RUNNING -eq 0 ] ; then | |
| 62 echo "$0 $ARG: $STATUS" | |
| 63 continue | |
| 64 fi | |
| 65 if kill $PID ; then | |
| 66 echo "$0 $ARG: roundup-server stopped" | |
| 67 else | |
| 68 echo "$0 $ARG: roundup-server could not be stopped" | |
| 69 ERROR=2 | |
| 70 fi | |
| 71 ;; | |
| 72 status) | |
| 73 echo $STATUS | |
| 74 ;; | |
| 75 *) | |
| 76 echo "usage: $0 (start|condstart|stop|status)" | |
| 77 cat <<EOF | |
| 78 | |
| 79 start - start roundup-server | |
| 80 condstart - start roundup-server if it's not running | |
| 81 stop - stop roundup-server | |
| 82 status - display roundup-server status | |
| 83 | |
| 84 EOF | |
| 85 ERROR=3 | |
| 86 ;; | |
| 87 | |
| 88 esac | |
| 89 | |
| 90 done | |
| 91 | |
| 92 exit $ERROR | |
| 93 |
