[open-ils-commits] r15566 - trunk/Open-ILS/src/support-scripts (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 17 15:35:32 EST 2010


Author: erickson
Date: 2010-02-17 15:35:27 -0500 (Wed, 17 Feb 2010)
New Revision: 15566

Modified:
   trunk/Open-ILS/src/support-scripts/brick_ctl.sh
Log:
added support for stopping/starting single (Perl) services in lieu of stop/start all via brick control.  Also added support for a -l localhost option, which i realize makes no sense in a brick environment, but if you are bouncing between single and multi server systems, it's nice to have the ability to control either with this script

Modified: trunk/Open-ILS/src/support-scripts/brick_ctl.sh
===================================================================
--- trunk/Open-ILS/src/support-scripts/brick_ctl.sh	2010-02-17 16:55:01 UTC (rev 15565)
+++ trunk/Open-ILS/src/support-scripts/brick_ctl.sh	2010-02-17 20:35:27 UTC (rev 15566)
@@ -67,7 +67,7 @@
 # -------------------------------------------------------------------
 # Load the config opts
 # -------------------------------------------------------------------
-while getopts  "a:x:bf:hu:c:i:" flag; do
+while getopts  "a:x:bf:hu:c:i:s:l" flag; do
     case $flag in   
         "a") OPT_ACTION="$OPTARG";;
         "u") OPT_FETCH_BASE_URL="$OPTARG";;
@@ -75,6 +75,8 @@
         "x") OPT_XUL_BUILD_DIR="$OPTARG";;
         "i") OPT_XUL_BUILD_ID="$OPTARG";;
         "c") OPT_CONFIG_FILE="$OPTARG";;
+        "l") OPT_LOCALHOST="-l";;
+        "s") OPT_SERVICE="$OPTARG";;
         "h"|*) usage;;
     esac;
 done
@@ -92,12 +94,14 @@
     fi;
 fi;
 
+[ -n "$OPT_LOCALHOST" ] && PERL_LOCALHOST_FLAG="--localhost";
 
 # make sure an action was specified
 [ -z "$OPT_ACTION" ] && usage;
 
-LOCAL_BASE="osrf_ctl.sh -d $OSRF_PID_DIR -c $OSRF_CONFIG";
+LOCAL_BASE="osrf_ctl.sh $OPT_LOCALHOST -d $OSRF_PID_DIR -c $OSRF_CONFIG";
 DRONE_BASE=". /etc/profile && osrf_ctl.sh -d $OSRF_PID_DIR -c $OSRF_CONFIG";
+PERL_CONTROLLER="opensrf-perl.pl --verbose $PERL_LOCALHOST_FLAG --config $OSRF_CONFIG --pid-dir $OSRF_PID_DIR --action $OPT_ACTION --service $OPT_SERVICE";
 
 # -------------------------------------------------------------------
 # Runs DRONE_ACT on the drones, then LOCAL_ACT on the local machine
@@ -186,6 +190,14 @@
     ln -s $NEW_DIR current;
 }
 
+# This is a per-service action.  Currently only support in Perl (and Python).
+# When other active languages are added, this script will need a language param
+# to determine which controller script to call.
+if [ -n "$OPT_SERVICE" ]; then
+    local_first "$PERL_CONTROLLER" "$PERL_CONTROLLER";
+    exit;
+fi;
+
 case $OPT_ACTION in
 
     "start_osrf") local_first "$LOCAL_BASE -a start_perl && $LOCAL_BASE -a start_c" \
@@ -210,7 +222,7 @@
     "stop_all") drone_first "$LOCAL_BASE -a stop_all" \
         "$DRONE_BASE -a stop_perl && $DRONE_BASE -a stop_c";;
 
-    "restart_all") $0 -a stop_all; $0 -a start_all;;
+    "restart_all") $0 $OPT_LOCALHOST -a stop_all; $0 $OPT_LOCALHOST -a start_all;;
     "build") cd ~/ILS/ && make clean default_config all;;
     "build_xul") make_xul;;
     "detach_brick") detach_brick;;



More information about the open-ils-commits mailing list