A solution for starting all Python services: make sh do the work
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 9 Nov 2010 21:39:44 +0000 (21:39 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 9 Nov 2010 21:39:44 +0000 (21:39 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2071 9efc2488-bf62-4759-914b-345cdb29e865

bin/osrf_ctl.sh.in
src/python/opensrf.py.in

index 5dd4747..a59afb1 100755 (executable)
@@ -156,12 +156,17 @@ stop_router() {
        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;
 }
 
index 809946b..9019b1c 100755 (executable)
@@ -148,6 +148,13 @@ def do_start(service):
     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 @@ elif action == 'restart':
     do_stop(service_name)
     do_start(service_name)
 
+elif action == 'list_all':
+    do_list_all()
+
 elif action == 'start_all':
     do_start_all()