From 6bfa00f63dd988b0137959d8d4a59337cbf099b1 Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 9 Nov 2010 21:39:44 +0000 Subject: [PATCH] A solution for starting all Python services: make sh do the work git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2071 9efc2488-bf62-4759-914b-345cdb29e865 --- bin/osrf_ctl.sh.in | 7 ++++++- src/python/opensrf.py.in | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/osrf_ctl.sh.in b/bin/osrf_ctl.sh.in index 5dd4747..a59afb1 100755 --- a/bin/osrf_ctl.sh.in +++ b/bin/osrf_ctl.sh.in @@ -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; } diff --git a/src/python/opensrf.py.in b/src/python/opensrf.py.in index 809946b..9019b1c 100755 --- a/src/python/opensrf.py.in +++ b/src/python/opensrf.py.in @@ -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() -- 2.43.2