added a "restartforce" option to force the code to at least try to restart
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Dec 2005 23:45:46 +0000 (23:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Dec 2005 23:45:46 +0000 (23:45 +0000)
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

index 40b9dc4..64c02fd 100755 (executable)
@@ -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;