From: Bill Erickson Date: Fri, 5 Jun 2015 16:06:20 +0000 (-0400) Subject: JBAS-712 marc_stream_importer.pl control script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d4884328209993c4be5b47ef3ef987a90f308b67;p=working%2FEvergreen.git JBAS-712 marc_stream_importer.pl control script sudo ./eg-marc-stream-control.sh [start | status | stop] --- diff --git a/KCLS/admin-scripts/eg-marc-stream-control.sh b/KCLS/admin-scripts/eg-marc-stream-control.sh new file mode 100755 index 0000000000..d55482d449 --- /dev/null +++ b/KCLS/admin-scripts/eg-marc-stream-control.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Control marc_stream_importer.pl +# sudo ./eg-marc-stream-control.sh [start |stop|status] + +PID_FILE=/openils/var/run/marc_stream_importer.pid +ACTION=$1 +STAFF_PASSWORD=$2 +STAFF_USER=admin +BIB_QUEUE=14 +BIB_MERGE_PROFILE=1 + +# marc_stream_importer.pl creates the PID file for us +function marc_stream_start { + if [ -z "$STAFF_PASSWORD" ]; then + echo "$0 start " + return + fi + cd /openils/bin + sudo -u opensrf ./marc_stream_importer.pl \ + --merge-profile $BIB_MERGE_PROFILE --user $STAFF_USER \ + --password $STAFF_PASSWORD --queue $BIB_QUEUE >> /dev/null 2>&1 & +} + +function marc_stream_stop { + if [ ! -f $PID_FILE ]; then + echo "marc_stream_importer is not running" + return; + fi + cd /openils/bin + sudo -u opensrf kill $(cat $PID_FILE) + sudo rm -f $PID_FILE +} + +function marc_stream_status { + set +e + if [ "$(ps ax | grep marc_stream | grep -v grep)" ]; then + echo "marc_stream_importer is running" + fi + set -e +} + + +case $ACTION in + "start") marc_stream_start;; + "stop") marc_stream_stop;; + "status") marc_stream_status;; + *) echo "$0 [start |stop|status]";; +esac; +