From 283058d2331074407211f84995989c8d6b46b0cd Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 6 Dec 2005 23:45:46 +0000 Subject: [PATCH] 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/ILS/trunk@2246 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- OpenSRF/bin/opensrf_all | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/OpenSRF/bin/opensrf_all b/OpenSRF/bin/opensrf_all index 40b9dc429e..64c02fdf58 100755 --- a/OpenSRF/bin/opensrf_all +++ b/OpenSRF/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; -- 2.43.2