[Opensrf-commits] r2071 - in trunk: bin src/python (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 9 16:39:50 EST 2010


Author: dbs
Date: 2010-11-09 16:39:44 -0500 (Tue, 09 Nov 2010)
New Revision: 2071

Modified:
   trunk/bin/osrf_ctl.sh.in
   trunk/src/python/opensrf.py.in
Log:
A solution for starting all Python services: make sh do the work


Modified: trunk/bin/osrf_ctl.sh.in
===================================================================
--- trunk/bin/osrf_ctl.sh.in	2010-11-09 18:17:50 UTC (rev 2070)
+++ trunk/bin/osrf_ctl.sh.in	2010-11-09 21:39:44 UTC (rev 2071)
@@ -156,12 +156,17 @@
 	return 0;
 }
 
+# The clean way to do this would be to invoke the "start_all" action
+# on opensrf.py, but that seems to randomly fail for services. So we
+# start each one separately from a bash script instead.
 start_python() {
     [ ! $($OSRF_CONFIG | grep OSRF_PYTHON) ] && return;
     echo "Starting OpenSRF Python";
     OPT_LOCAL=""
     [ "$OSRF_HOSTNAME" = "localhost" ] && OPT_LOCAL="-l"
-    opensrf.py -d -p $OPT_PID_DIR -f $OPT_CONFIG -a start_all $OPT_LOCAL
+    for service in `opensrf.py -a list_all $OPT_LOCAL`; do
+            opensrf.py -p $OPT_PID_DIR -d -a start -s $service $OPT_LOCAL
+    done
     return 0;
 }
 

Modified: trunk/src/python/opensrf.py.in
===================================================================
--- trunk/src/python/opensrf.py.in	2010-11-09 18:17:50 UTC (rev 2070)
+++ trunk/src/python/opensrf.py.in	2010-11-09 21:39:44 UTC (rev 2071)
@@ -148,6 +148,13 @@
     controller.run()
     os._exit(0)
 
+def do_list_all():
+    '''
+    List all Python services listed in the OpenSRF configuration file
+    '''
+    for service in services.keys():
+        print service
+
 def do_start_all():
     '''
     Start all Python services listed in the OpenSRF configuration file
@@ -233,6 +240,9 @@
     do_stop(service_name)
     do_start(service_name)
 
+elif action == 'list_all':
+    do_list_all()
+
 elif action == 'start_all':
     do_start_all()
 



More information about the opensrf-commits mailing list