From e02abf123f317cc97c15ef52b27a8d2b9847f23a Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Fri, 10 Jun 2011 13:43:32 -0400 Subject: [PATCH] Make some oils_ctl.sh improvements. Add start|stop|restart commands for z39.50 to oils_ctl.sh. Use LOCALSTATEDIR and SYSCONFDIR configuration variables in oils_ctl.sh. Modify the existing SIP2 commands in oils_ctl.sh to use these configuration variables. Modify src/Makefile.am to replace LOCALSTATEDIR and SYSCONFDIR variables in oils_ctl.sh when installing. Add example/default xml configurations for z39.50: Open-ILS/examples/oils_yaz.xml.example Open-ILS/examples/oils_z3950.xml.example Signed-off-by: Jason Stephenson Signed-off-by: Dan Scott --- Open-ILS/examples/oils_ctl.sh | 39 ++++++++++++++++++++++++++++---- Open-ILS/examples/oils_yaz.xml.example | 14 ++++++++++++ Open-ILS/examples/oils_z3950.xml.example | 19 ++++++++++++++++ Open-ILS/src/Makefile.am | 8 +++++-- 4 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/examples/oils_yaz.xml.example create mode 100644 Open-ILS/examples/oils_z3950.xml.example diff --git a/Open-ILS/examples/oils_ctl.sh b/Open-ILS/examples/oils_ctl.sh index c88dc671b3..d47ba6f3cd 100755 --- a/Open-ILS/examples/oils_ctl.sh +++ b/Open-ILS/examples/oils_ctl.sh @@ -1,9 +1,12 @@ #!/bin/bash OPT_ACTION="" -OPT_SIP_CONFIG="" -OPT_PID_DIR="" +OPT_SIP_CONFIG="SYSCONFDIR/oils_sip.xml" +OPT_PID_DIR="LOCALSTATEDIR/run" OPT_SIP_ERR_LOG="/dev/null"; +OPT_Z3950_CONFIG="SYSCONFDIR/oils_z3950.xml" +OPT_YAZ_CONFIG="SYSCONFDIR/oils_yaz.xml" +Z3950_LOG="LOCALSTATEDIR/log/oils_z3950.log" SIP_DIR="/opt/SIPServer"; # --------------------------------------------------------------------------- @@ -14,12 +17,18 @@ SIP_DIR="/opt/SIPServer"; function usage { echo ""; - echo "usage: $0 -d -s -a -l "; + echo "usage: $0 -d -s -z -y -a -l "; echo ""; echo "Actions include:" echo -e "\tstart_sip" echo -e "\tstop_sip" echo -e "\trestart_sip" + echo -e "\tstart_z3950" + echo -e "\tstop_z3950" + echo -e "\trestart_z3950" + echo -e "\tstart_all" + echo -e "\tstop_all" + echo -e "\trestart_all" exit; } @@ -33,6 +42,8 @@ while getopts "a:d:s:l:" flag; do "s") OPT_SIP_CONFIG="$OPTARG";; "d") OPT_PID_DIR="$OPTARG";; "l") OPT_SIP_ERR_LOG="$OPTARG";; + "z") OPT_Z3950_CONFIG="$OPTARG";; + "y") OPT_YAZ_CONFIG="$OPTARG";; "h"|*) usage;; esac; done @@ -42,7 +53,7 @@ done [ -z "$OPT_ACTION" ] && usage; PID_SIP="$OPT_PID_DIR/oils_sip.pid"; - +PID_Z3950="$OPT_PID_DIR/oils_z3950.pid"; # --------------------------------------------------------------------------- # Utility code for checking the PID files @@ -90,7 +101,7 @@ function start_sip { do_action "start" $PID_SIP "OILS SIP Server"; DIR=$(pwd); cd $SIP_DIR; - perl SIPServer.pm "$OPT_SIP_CONFIG" >> "$OPT_SIP_ERR_LOG" 2>&1 & + perl SIPServer.pm "$OPT_SIP_CONFIG" >> "$OPT_SIP_ERR_LOG" 2>&1 & pid=$!; cd $DIR; echo $pid > $PID_SIP; @@ -102,6 +113,18 @@ function stop_sip { return 0; } +function start_z3950 { + do_action "start" $PID_Z3950 "OILS Z39.50 Server"; + simple2zoom -c $OPT_Z3950_CONFIG -- -f $OPT_YAZ_CONFIG >> "$Z3950_LOG" 2>&1 & + pid=$!; + echo $pid > $PID_Z3950; + return 0; +} + +function stop_z3950 { + do_action "stop" $PID_Z3950 "OILS Z39.50 Server"; + return 0; +} # --------------------------------------------------------------------------- @@ -111,6 +134,12 @@ case $OPT_ACTION in "start_sip") start_sip;; "stop_sip") stop_sip;; "restart_sip") stop_sip; start_sip;; + "start_z3950") start_z3950;; + "stop_z3950") stop_z3950;; + "restart_z3950") stop_z3950; start_z3950;; + "start_all") start_sip; start_z3950;; + "stop_all") stop_sip; stop_z3950;; + "restart_all") stop_sip; stop_z3950; start_sip; start_z3950;; *) usage;; esac; diff --git a/Open-ILS/examples/oils_yaz.xml.example b/Open-ILS/examples/oils_yaz.xml.example new file mode 100644 index 0000000000..df3896d784 --- /dev/null +++ b/Open-ILS/examples/oils_yaz.xml.example @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/Open-ILS/examples/oils_z3950.xml.example b/Open-ILS/examples/oils_z3950.xml.example new file mode 100644 index 0000000000..6fe8777c48 --- /dev/null +++ b/Open-ILS/examples/oils_z3950.xml.example @@ -0,0 +1,19 @@ + + + + http://localhost/opac/extras/sru + + marc-8 + + cql + eg.title + eg.keyword + eg.keyword + eg.subject + eg.author + eg.publisher + eg.keyword + eg.keyword + + + diff --git a/Open-ILS/src/Makefile.am b/Open-ILS/src/Makefile.am index 834d71e923..796d39c70c 100644 --- a/Open-ILS/src/Makefile.am +++ b/Open-ILS/src/Makefile.am @@ -45,7 +45,9 @@ sysconf_DATA = $(examples)/action_trigger_filters.json.example \ $(examples)/fm_IDL.xml \ $(examples)/oils_sip.xml.example \ $(examples)/oils_web.xml.example \ - $(examples)/lib_ips.txt.example + $(examples)/lib_ips.txt.example \ + $(examples)/oils_yaz.xml.example \ + $(examples)/oils_z3950.xml.example #---------------------------- # Build ILS CORE @@ -73,7 +75,7 @@ core_scripts = $(examples)/oils_ctl.sh \ $(supportscr)/action_trigger_runner.pl \ $(srcdir)/extras/openurl_map.pl \ $(srcdir)/extras/import/marc_add_ids - + installautojs = $(autojsbinscripts) #circ-rules-install @@ -184,6 +186,8 @@ ilscore-install: sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl' sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/thaw_expired_frozen_holds.srfsh' sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/offline-blocked-list.pl' + sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@bindir@/oils_ctl.sh' + sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/oils_ctl.sh' reporter-install: sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/clark-kent.pl' -- 2.11.0