Bug 7238 : Shifting SIPconfig.xml to the etc dir and the scripts to misc/bin
authorChris Cormack <chrisc@catalyst.net.nz>
Thu, 17 Nov 2011 00:17:01 +0000 (13:17 +1300)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 3 Feb 2012 14:15:22 +0000 (15:15 +0100)
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
The scripts run with the caveat that you must specify the path to SIPconfig.xml. The followup previously attached should take care of that issue.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/SIP/SIPconfig.xml [deleted file]
C4/SIP/sip_run.sh [deleted file]
C4/SIP/sip_shutdown.sh [deleted file]
etc/SIPconfig.xml [new file with mode: 0644]
misc/bin/sip_run.sh [new file with mode: 0755]
misc/bin/sip_shutdown.sh [new file with mode: 0755]

diff --git a/C4/SIP/SIPconfig.xml b/C4/SIP/SIPconfig.xml
deleted file mode 100644 (file)
index f229b9a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<acsconfig xmlns="http://openncip.org/acs-config/1.0/">
-<!-- above address gets nothing, it's just a namespace -->
-  <error-detect enabled="true" />
-
-<!--
-  Set Net::Server::PreFork runtime parameters 
-  syslog_ident will identify SIP2 Koha server entries in syslog
-  For OpenSolaris, add: syslog_logsock=stream
--->
-  <server-params
-    min_servers='1'
-    min_spare_servers='0' 
-    log_file='Sys::Syslog'
-    syslog_ident='koha_sip'
-    syslog_facility='local6'
-  />
-  
-  <listeners>
-<!-- vestigial HTTP, never implemented: just use the OPAC!
-       <service
-      port="0:8080/tcp"
-      transport="http"
-      protocol="NCIP/1.0" />
--->
-    <service
-      port="8023/tcp"
-      transport="telnet"
-      protocol="SIP/2.00"
-      timeout="60" />
-
-    <service
-      port="127.0.0.1:6001/tcp"
-      transport="RAW" 
-      protocol="SIP/2.00"
-      timeout="60" />
-  </listeners>
-
-  <accounts>
-      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" />
-      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" />
-      <login id="koha2"  password="koha" institution="kohalibrary2" />
-      <login id="lpl-sc" password="1234" institution="LPL" />
-      <login id="lpl-sc-beacock" password="xyzzy"
-             delimiter="|" error-detect="enabled" institution="LPL" />
-  </accounts>
-
-<!--
-Institution tags are for enabled branches.  There needs to be one
-institution stanza for each institution named in the accounts above.
-The implementation attribute is actually used to find the code to run,
-in our case "ILS".
--->
-
-<institutions>
-    <institution id="MAIN" implementation="ILS" parms="">
-          <policy checkin="true" renewal="true" checkout="true"
-                 status_update="false" offline="false"
-                 timeout="100"
-                 retries="5" />
-    </institution>
-    <institution id="CPL" implementation="ILS" parms="">
-          <policy checkin="true" renewal="true" checkout="true"
-                 status_update="false" offline="false"
-                 timeout="25"
-                 retries="5" />
-    </institution>
-    <institution id="kohalibrary" implementation="ILS" parms="">
-          <policy checkin="true" renewal="false" checkout="true"
-                 status_update="false" offline="false"
-                 timeout="100"
-                 retries="5" />
-    </institution>
-    <institution id="kohalibrary2" implementation="ILS" parms="">
-          <policy checkin="true" renewal="false" checkout="true"
-                 timeout="100"
-                 retries="3" />
-    </institution>
-    <institution id="LPL" implementation="ILS">
-          <policy checkin="true" renewal="false" checkout="true"
-                 timeout="100"
-                 retries="5" />
-    </institution>
-</institutions>
-</acsconfig>
diff --git a/C4/SIP/sip_run.sh b/C4/SIP/sip_run.sh
deleted file mode 100755 (executable)
index b1bc8d9..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# 
-# A sample script for starting SIP.  
-# You probably want to specify new log destinations.
-#
-# Takes 3 optional arguments:
-# ~ SIPconfig.xml file to use
-# ~ file for STDOUT, default ~/sip.out
-# ~ file for STDERR, default ~/sip.err
-#
-# The STDOUT and STDERR files are only for the SIPServer process itself.
-# Actual SIP communication and transaction logs are handled by Syslog.
-#
-# Examples:
-#   sip_run.sh /path/to/SIPconfig.xml
-#   sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log
-
-
-for x in HOME PERL5LIB KOHA_CONF ; do
-       echo $x=${!x}
-       if [ -z ${!x} ] ; then 
-               echo ERROR: $x not defined;
-               exit 1;
-       fi;
-done;
-unset x;
-cd $PERL5LIB/C4/SIP;
-echo;
-
-sipconfig=${1};
-outfile=${2:-$HOME/sip.out};
-errfile=${3:-$HOME/sip.err};
-
-if [ $sipconfig ]; then
-       echo "Running with config file located in $sipconfig" ;
-       echo "Calling (backgrounded):";
-       echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile";
-       perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile &
-
-else
-       echo "Please specify a config file and try again."
-fi
diff --git a/C4/SIP/sip_shutdown.sh b/C4/SIP/sip_shutdown.sh
deleted file mode 100755 (executable)
index 07abbce..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-. $HOME/.bash_profile
-
-# this is brittle: the primary server must have the lowest PPID
-# this is brittle: ps behavior is very platform-specific, only tested on Debian Etch
-
-target="SIPServer";
-PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}');
-
-if [ ! $PROCPID ] ; then
-    echo "No processes found for $target";
-    exit;
-fi
-
-echo "SIP Processes for this user ($USER):";
-ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ;
-echo "Killing process #$PROCPID";
-kill $PROCPID;
diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml
new file mode 100644 (file)
index 0000000..f229b9a
--- /dev/null
@@ -0,0 +1,84 @@
+<acsconfig xmlns="http://openncip.org/acs-config/1.0/">
+<!-- above address gets nothing, it's just a namespace -->
+  <error-detect enabled="true" />
+
+<!--
+  Set Net::Server::PreFork runtime parameters 
+  syslog_ident will identify SIP2 Koha server entries in syslog
+  For OpenSolaris, add: syslog_logsock=stream
+-->
+  <server-params
+    min_servers='1'
+    min_spare_servers='0' 
+    log_file='Sys::Syslog'
+    syslog_ident='koha_sip'
+    syslog_facility='local6'
+  />
+  
+  <listeners>
+<!-- vestigial HTTP, never implemented: just use the OPAC!
+       <service
+      port="0:8080/tcp"
+      transport="http"
+      protocol="NCIP/1.0" />
+-->
+    <service
+      port="8023/tcp"
+      transport="telnet"
+      protocol="SIP/2.00"
+      timeout="60" />
+
+    <service
+      port="127.0.0.1:6001/tcp"
+      transport="RAW" 
+      protocol="SIP/2.00"
+      timeout="60" />
+  </listeners>
+
+  <accounts>
+      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" />
+      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" />
+      <login id="koha2"  password="koha" institution="kohalibrary2" />
+      <login id="lpl-sc" password="1234" institution="LPL" />
+      <login id="lpl-sc-beacock" password="xyzzy"
+             delimiter="|" error-detect="enabled" institution="LPL" />
+  </accounts>
+
+<!--
+Institution tags are for enabled branches.  There needs to be one
+institution stanza for each institution named in the accounts above.
+The implementation attribute is actually used to find the code to run,
+in our case "ILS".
+-->
+
+<institutions>
+    <institution id="MAIN" implementation="ILS" parms="">
+          <policy checkin="true" renewal="true" checkout="true"
+                 status_update="false" offline="false"
+                 timeout="100"
+                 retries="5" />
+    </institution>
+    <institution id="CPL" implementation="ILS" parms="">
+          <policy checkin="true" renewal="true" checkout="true"
+                 status_update="false" offline="false"
+                 timeout="25"
+                 retries="5" />
+    </institution>
+    <institution id="kohalibrary" implementation="ILS" parms="">
+          <policy checkin="true" renewal="false" checkout="true"
+                 status_update="false" offline="false"
+                 timeout="100"
+                 retries="5" />
+    </institution>
+    <institution id="kohalibrary2" implementation="ILS" parms="">
+          <policy checkin="true" renewal="false" checkout="true"
+                 timeout="100"
+                 retries="3" />
+    </institution>
+    <institution id="LPL" implementation="ILS">
+          <policy checkin="true" renewal="false" checkout="true"
+                 timeout="100"
+                 retries="5" />
+    </institution>
+</institutions>
+</acsconfig>
diff --git a/misc/bin/sip_run.sh b/misc/bin/sip_run.sh
new file mode 100755 (executable)
index 0000000..b1bc8d9
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+# 
+# A sample script for starting SIP.  
+# You probably want to specify new log destinations.
+#
+# Takes 3 optional arguments:
+# ~ SIPconfig.xml file to use
+# ~ file for STDOUT, default ~/sip.out
+# ~ file for STDERR, default ~/sip.err
+#
+# The STDOUT and STDERR files are only for the SIPServer process itself.
+# Actual SIP communication and transaction logs are handled by Syslog.
+#
+# Examples:
+#   sip_run.sh /path/to/SIPconfig.xml
+#   sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log
+
+
+for x in HOME PERL5LIB KOHA_CONF ; do
+       echo $x=${!x}
+       if [ -z ${!x} ] ; then 
+               echo ERROR: $x not defined;
+               exit 1;
+       fi;
+done;
+unset x;
+cd $PERL5LIB/C4/SIP;
+echo;
+
+sipconfig=${1};
+outfile=${2:-$HOME/sip.out};
+errfile=${3:-$HOME/sip.err};
+
+if [ $sipconfig ]; then
+       echo "Running with config file located in $sipconfig" ;
+       echo "Calling (backgrounded):";
+       echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile";
+       perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile &
+
+else
+       echo "Please specify a config file and try again."
+fi
diff --git a/misc/bin/sip_shutdown.sh b/misc/bin/sip_shutdown.sh
new file mode 100755 (executable)
index 0000000..07abbce
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+. $HOME/.bash_profile
+
+# this is brittle: the primary server must have the lowest PPID
+# this is brittle: ps behavior is very platform-specific, only tested on Debian Etch
+
+target="SIPServer";
+PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}');
+
+if [ ! $PROCPID ] ; then
+    echo "No processes found for $target";
+    exit;
+fi
+
+echo "SIP Processes for this user ($USER):";
+ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ;
+echo "Killing process #$PROCPID";
+kill $PROCPID;