@@ -, +, @@ Do whatever is needed for your site's SIP configuration not required for testing) --- debian/docs/koha-enable-sip.xml | 58 +++++++++++++++++++++++++++++++++++++++ debian/docs/koha-start-sip.xml | 53 +++++++++++++++++++++++++++++++++++ debian/docs/koha-stop-sip.xml | 53 +++++++++++++++++++++++++++++++++++ debian/koha-common.init | 4 +++ debian/koha-common.install | 3 ++ debian/scripts/koha-enable-sip | 38 +++++++++++++++++++++++++ debian/scripts/koha-start-sip | 49 +++++++++++++++++++++++++++++++++ debian/scripts/koha-stop-sip | 52 +++++++++++++++++++++++++++++++++++ 8 files changed, 310 insertions(+) create mode 100644 debian/docs/koha-enable-sip.xml create mode 100644 debian/docs/koha-start-sip.xml create mode 100644 debian/docs/koha-stop-sip.xml create mode 100755 debian/scripts/koha-enable-sip create mode 100755 debian/scripts/koha-start-sip create mode 100755 debian/scripts/koha-stop-sip --- a/debian/docs/koha-enable-sip.xml +++ a/debian/docs/koha-enable-sip.xml @@ -0,0 +1,58 @@ +
+koha-enable-sip + + Koha is the first free software library automation package. + + + Robin + Sheat + + + Catalyst IT + http://www.catalyst.net.nz + + Author + + + + + + + koha-enable-sip + 8 + + + + koha-enable-sip + Copies the SIP configuration file to allow SIP to be controlled by init scripts. + UNIX/Linux + + + + + koha-enable-sip + instancename + + + + Description + This copies the default SIP configuration file /etc/koha/SIPconfig.xml to the + /etc/koha/sites/instancename directory. This allows it to be started by + koha-start-sip(8), and koha-stop-sip. In turn, + this means that it will be started on boot and stopped on shutdown. + After running this, you will need to edit the newly created file to configure it + for your site. + To disable SIP again, delete or rename the configuration file. + + + See also + + koha-start-sip(8) + koha-stop-sip(8) + + + + + +
+ --- a/debian/docs/koha-start-sip.xml +++ a/debian/docs/koha-start-sip.xml @@ -0,0 +1,53 @@ +
+koha-start-sip + + Koha is the first free software library automation package. + + + Robin + Sheat + + + Catalyst IT + http://www.catalyst.net.nz + + Author + + + + + + + koha-start-sip + 8 + + + + koha-start-sip + Starts the SIP daemon for the specified Koha instances. + UNIX/Linux + + + + + koha-start-sip + instancename + + + + Description + This will start the SIP daemon for the Koha instance specified by instancename. + If the SIP configuration is not present for the supplied instance, it will be silently skipped. + To enable SIP support for an instance, refer to koha-enable-sip(8). + + + See also + + koha-stop-sip(8) + koha-enable-sip(8) + + + + + +
--- a/debian/docs/koha-stop-sip.xml +++ a/debian/docs/koha-stop-sip.xml @@ -0,0 +1,53 @@ +
+koha-stop-sip + + Koha is the first free software library automation package. + + + Robin + Sheat + + + Catalyst IT + http://www.catalyst.net.nz + + Author + + + + + + + koha-stop-sip + 8 + + + + koha-stop-sip + Stops the SIP daemon for the specified Koha instances. + UNIX/Linux + + + + + koha-stop-sip + instancename + + + + Description + This will stop the SIP daemon for the Koha instance specified by instancename. + If it's not running, an note will be displayed. + + + See also + + koha-start-sip(8) + koha-enable-sip(8) + + + + + +
+ --- a/debian/koha-common.init +++ a/debian/koha-common.init @@ -45,6 +45,7 @@ do_start() # We insure all required directories exist, including disabled ones. koha-create-dirs $(koha-list) koha-start-zebra $(koha-list --enabled) + koha-start-sip $(koha-list --enabled) } # @@ -54,6 +55,7 @@ do_stop() { # We stop everything, including disabled ones. koha-stop-zebra $(koha-list) || true + koha-stop-sip $(koha-list) || true } # @@ -61,6 +63,8 @@ do_stop() # do_reload() { koha-restart-zebra $(koha-list --enabled) + koha-stop-sip $(koha-list) || true + koha-start-sip $(koha-list --enabled) } case "$1" in --- a/debian/koha-common.install +++ a/debian/koha-common.install @@ -28,4 +28,7 @@ debian/scripts/koha-start-zebra usr/sbin debian/scripts/koha-stop-zebra usr/sbin debian/scripts/koha-upgrade-schema usr/sbin debian/scripts/koha-upgrade-to-3.4 usr/sbin +debian/scripts/koha-start-sip usr/sbin +debian/scripts/koha-stop-sip usr/sbin +debian/scripts/koha-enable-sip usr/sbin debian/tmp_docbook/*.8 usr/share/man/man8 --- a/debian/scripts/koha-enable-sip +++ a/debian/scripts/koha-enable-sip @@ -0,0 +1,38 @@ +#!/bin/sh +# +# koha-enable-sip -- Set up the config files to allow SIP to run +# Copyright 2012 Catalyst IT, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +for name in "$@" +do + if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; + then + echo "No such instance: ${name}" > /dev/stderr + continue; + fi + sipfile=/etc/koha/sites/${name}/SIPconfig.xml + if [ -e ${sipfile} ] + then + echo "SIP already enabled for $name" + else + echo "Enabling SIP for $name - edit ${sipfile} to configure" + cp -v /etc/koha/SIPconfig.xml ${sipfile} + chown ${name}-koha:${name}-koha ${sipfile} + chmod 600 ${sipfile} + fi +done --- a/debian/scripts/koha-start-sip +++ a/debian/scripts/koha-start-sip @@ -0,0 +1,49 @@ +#!/bin/sh +# +# koha-start-sip -- Start SIP server for named Koha instance +# Copyright 2012 Catalyst IT, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +for name in "$@" +do + if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; + then + echo "No such instance: ${name}" > /dev/stderr + continue; + fi + [ -e /etc/koha/sites/${name}/SIPconfig.xml ] || continue + echo "Starting SIP server for $name" + mkdir -p /var/run/koha/${name} + chown "${name}-koha:${name}-koha" /var/run/koha/${name} + export KOHA_CONF PERL5LIB + KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml + PERL5LIB=/usr/share/koha/lib + daemon \ + --name="$name-koha-sip" \ + --errlog="/var/log/koha/$name/sip-error.log" \ + --stdout="/var/log/koha/$name/sip.log" \ + --output="/var/log/koha/$name/sip-output.log" \ + --verbose=1 \ + --respawn \ + --delay=30 \ + --pidfiles="/var/run/koha/${name}" \ + --user="$name-koha.$name-koha" \ + -- \ + perl \ + "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \ + "/etc/koha/sites/${name}/SIPconfig.xml" +done --- a/debian/scripts/koha-stop-sip +++ a/debian/scripts/koha-stop-sip @@ -0,0 +1,52 @@ +#!/bin/sh +# +# koha-stop-sip -- Stop SIP server for named Koha instance +# Copyright 2012 Catalyst IT, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +for name in "$@" +do + if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; + then + echo "No such instance: ${name}" > /dev/stderr + continue; + fi + if [ ! -e /var/run/koha/${name}/${name}-koha-sip.pid ] ; + then + echo "SIP server for ${name} not running." + continue; + fi + echo "Stopping SIP server for $name" + KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml + PERL5LIB=/usr/share/koha/lib + export KOHA_CONF PERL5LIB + daemon \ + --name="$name-koha-sip" \ + --errlog="/var/log/koha/$name/sip-error.log" \ + --stdout="/var/log/koha/$name/sip.log" \ + --output="/var/log/koha/$name/sip-output.log" \ + --verbose=1 \ + --respawn \ + --delay=30 \ + --pidfiles="/var/run/koha/${name}" \ + --user="$name-koha.$name-koha" \ + --stop \ + -- \ + perl \ + "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \ + "/etc/koha/sites/${name}/SIPconfig.xml" +done --