Make some oils_ctl.sh improvements.
authorJason Stephenson <jstephenson@mvlc.org>
Fri, 10 Jun 2011 17:43:32 +0000 (13:43 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 23 Aug 2011 18:54:29 +0000 (14:54 -0400)
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 <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/examples/oils_ctl.sh
Open-ILS/examples/oils_yaz.xml.example [new file with mode: 0644]
Open-ILS/examples/oils_z3950.xml.example [new file with mode: 0644]
Open-ILS/src/Makefile.am

index c88dc67..d47ba6f 100755 (executable)
@@ -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 <pid_dir> -s <sip_config> -a <action> -l <sip_err_log>";
+       echo "usage: $0 -d <pid_dir> -s <sip_config> -z <z3950_config> -y <yaz_config> -a <action> -l <sip_err_log>";
        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 (file)
index 0000000..df3896d
--- /dev/null
@@ -0,0 +1,14 @@
+<yazgfs>
+  <!-- You can add a listen entry, if you want your z39.50 server to
+       listen on a port other than the default, 9999. -->
+    <server id="server1">
+    <retrievalinfo>
+        <retrieval syntax="xml"/>
+        <retrieval syntax="marc21">
+            <backend syntax="xml">
+                <marc inputformat="xml" outputformat="marc" inputcharset="utf-8" outputcharset="marc-8"/>
+            </backend>
+        </retrieval>
+    </retrievalinfo>
+    </server>
+</yazgfs>
diff --git a/Open-ILS/examples/oils_z3950.xml.example b/Open-ILS/examples/oils_z3950.xml.example
new file mode 100644 (file)
index 0000000..6fe8777
--- /dev/null
@@ -0,0 +1,19 @@
+<client>
+   <database name="OILS">
+     <!-- Change "localhost" to your server's name as appropriate. -->
+     <zurl>http://localhost/opac/extras/sru</zurl>
+     <option name="sru">get</option>
+     <charset>marc-8</charset>
+     <search>
+       <querytype>cql</querytype>
+       <map use="4"><index>eg.title</index></map>
+       <map use="7"><index>eg.keyword</index></map>
+       <map use="8"><index>eg.keyword</index></map>
+       <map use="21"><index>eg.subject</index></map>
+       <map use="1003"><index>eg.author</index></map>
+       <map use="1018"><index>eg.publisher</index></map>
+       <map use="1035"><index>eg.keyword</index></map>
+       <map use="1016"><index>eg.keyword</index></map>
+     </search>
+   </database>
+</client>
index 834d71e..796d39c 100644 (file)
@@ -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'