From: erickson Date: Tue, 6 Dec 2005 23:45:46 +0000 (+0000) Subject: added a "restartforce" option to force the code to at least try to restart X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f17c516825e3170668d07e4de2bd9b89f1bebb54;p=working%2FOpenSRF.git added a "restartforce" option to force the code to at least try to restart this is added since the restart script may get hung up on other code (srfsh) occupying the jabber port git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@600 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/bin/opensrf_all b/bin/opensrf_all index 40b9dc4..64c02fd 100755 --- a/bin/opensrf_all +++ b/bin/opensrf_all @@ -54,26 +54,28 @@ export PATH="$PREFIX/bin:$PATH"; function fail { echo "$0 exited: $*"; exit 99; } -function usage { echo "$0 [ start | stop | restart ]"; } +function usage { echo "$0 [ start | stop | restart | restartforce ]"; } function startJserver { ACTIVE=$(netstat -an | grep $JSERVERPORT); - if [ ! -z "$ACTIVE" ]; then - - echo "Port $JSERVERPORT is busy. Waiting 60 seconds for the port to clear up..." - - for ((i=0; i!= 60; i++)) { + if [ -z "$1" ]; then + if [ ! -z "$ACTIVE" ]; then + + echo "Port $JSERVERPORT is busy. Waiting 60 seconds for the port to clear up..." + + for ((i=0; i!= 60; i++)) { + ACTIVE=$(netstat -an | grep $JSERVERPORT); + [ -z "$ACTIVE" ] && break; + echo -n "+"; + sleep 1; + } + echo ""; ACTIVE=$(netstat -an | grep $JSERVERPORT); - [ -z "$ACTIVE" ] && break; - echo -n "+"; - sleep 1; - } - echo ""; - ACTIVE=$(netstat -an | grep $JSERVERPORT); - [ ! -z "$ACTIVE" ] && fail "Port $JSERVERPORT is busy...exiting"; + [ ! -z "$ACTIVE" ] && fail "Port $JSERVERPORT is busy...exiting"; + fi; fi; "$BINDIR/$JSERVERBIN" "$ETCDIR/opensrf_core.xml" "chopchop"; @@ -103,7 +105,7 @@ function makeMeGo { if [ ! -z "$JSERVER" ]; then echo "Starting Chop Chop, Jabber (jserver-c)..."; - startJserver; + startJserver $1; echo "Chop Chop started OK"; fi @@ -148,6 +150,7 @@ function stopMe { [ "$1" = "stop" ] && stopMe && exit; [ "$1" = "restart" ] && stopMe && makeMeGo && exit; +[ "$1" = "restartforce" ] && stopMe && makeMeGo 1 && exit; [ "$1" = "start" ] && makeMeGo && exit;