From fb6af104e30c468df431eb943201f82e9798c99b Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 5 Nov 2010 20:57:43 +0000 Subject: [PATCH] Patch from Michael Giarlo to integrate python service control into osrf_ctl.sh. I made the following additional changes: 1. copy opensrf.py into the BIN dir during install when --enable-python is used. 2. osrf_ctl.sh will not attempt to control python services when python is not enabled for opensrf. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2055 9efc2488-bf62-4759-914b-345cdb29e865 --- bin/osrf_ctl.sh.in | 37 +++++++++++++++++++++++++++++++------ src/Makefile.am | 4 ++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/bin/osrf_ctl.sh.in b/bin/osrf_ctl.sh.in index 8110442..5dd4747 100755 --- a/bin/osrf_ctl.sh.in +++ b/bin/osrf_ctl.sh.in @@ -48,6 +48,9 @@ Actions include: start_perl stop_perl restart_perl + start_python + stop_python + restart_python start_c stop_c restart_c @@ -153,6 +156,25 @@ stop_router() { return 0; } +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 + return 0; +} + +stop_python() { + [ ! $($OSRF_CONFIG | grep OSRF_PYTHON) ] && return; + echo "Stopping OpenSRF Python"; + OPT_LOCAL="" + [ "$OSRF_HOSTNAME" = "localhost" ] && OPT_LOCAL="-l" + opensrf.py -p $OPT_PID_DIR -f $OPT_CONFIG -a stop_all $OPT_LOCAL + sleep 1; + return 0; +} + start_perl() { echo "Starting OpenSRF Perl"; opensrf-perl.pl --verbose --pid-dir $OPT_PID_DIR \ @@ -196,15 +218,18 @@ case $OPT_ACTION in "start_perl") start_perl;; "stop_perl") stop_perl;; "restart_perl") stop_perl; start_perl;; + "start_python") start_python;; + "stop_python") stop_python;; + "restart_python") stop_python; start_python;; "start_c") start_c;; "stop_c") stop_c;; "restart_c") stop_c; start_c;; - "start_osrf") start_perl; start_c;; - "stop_osrf") stop_perl; stop_c;; - "restart_osrf") stop_perl; stop_c; start_perl; start_c;; - "stop_all") stop_c; stop_perl; stop_router;; - "start_all") start_router; start_perl; start_c;; - "restart_all") stop_c; stop_perl; stop_router; start_router; start_perl; start_c;; + "start_osrf") start_perl; start_c; start_python;; + "stop_osrf") stop_python; stop_c; start_perl;; + "restart_osrf") stop_python; stop_c; stop_perl; start_perl; start_c; start_python;; + "stop_all") stop_python; stop_c; stop_perl; stop_router;; + "start_all") start_router; start_perl; start_c; start_python;; + "restart_all") stop_python; stop_c; stop_perl; stop_router; start_router; start_perl; start_c; start_python;; *) usage;; esac; diff --git a/src/Makefile.am b/src/Makefile.am index cca44d6..ea16727 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,7 +41,11 @@ endif if BUILDCORE MAYBE_CORE = libopensrf c-apps router srfsh gateway perl +if BUILDPYTHON +dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl @top_srcdir@/src/python/opensrf.py +else dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl +endif bin_SCRIPTS = @top_srcdir@/bin/osrf_config @top_srcdir@/bin/osrf_ctl.sh dist_sysconf_DATA = @top_srcdir@/examples/opensrf.xml.example @top_srcdir@/examples/opensrf_core.xml.example @top_srcdir@/examples/srfsh.xml.example endif -- 2.43.2