Patch from Michael Giarlo to integrate python service control into osrf_ctl.sh.
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 5 Nov 2010 20:57:43 +0000 (20:57 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 5 Nov 2010 20:57:43 +0000 (20:57 +0000)
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
src/Makefile.am

index 8110442..5dd4747 100755 (executable)
@@ -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;
 
index cca44d6..ea16727 100644 (file)
@@ -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