Koha/debian/scripts/koha-start-sip
Robin Sheat 3dc22e7fb2 Bug 9250 - [SIGNED-OFF] provide commands to manage the SIP server
This adds commands required to control the SIP server. These commands
are:
* koha-enable-sip - copies the SIP config to the sites directory
* koha-start-sip - starts the SIP server processes
* koha-stop-sip - stops the SIP server processes

It also calls these as appropriate from the koha-common init script.

To use:
1) sudo koha-enable-sip instancename
2) sudo vim /etc/koha/sites/instancename/SIPconfig.xml
   Do whatever is needed for your site's SIP configuration
3) sudo koha-start-sip instancename

To test:
1) Build packages with this patch
2) Ensure that sudo koha-start-sip instancename doesn't do anything
3) Run sudo koha-enable-sip instancename
4) Edit /etc/koha/sites/instancename/SIPconfig.xml if needed (probably
   not required for testing)
5) Run sudo koha-start-sip instancename
6) Note that the sip processes are now running
7) Run sudo koha-stop-sip instancename
8) Note that the sip processes have gone
9) Reboot your Koha server
10) Note that the sip processes are back

Sponsored-By: Waitaki District Council Libraries
Sponsored-By: South Taranaki District Council Libraries
Sponsored-By: Horowhenua District Council Libraries
Sponsored-By: Rangitikei District Council Libraries

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Works as advertised. koha-start-sip without a prior koha-enable-sip
does nothing. koha-enable-sip copies the SIP config file to the
instance directory. After koha-enable-sip, koha-start-sip and
koha-stop-sip works as expected. After a reboot, the SIP processes are
still running. I have not actually tested the SIP servers after they
have been started, but assume they work the same as always.
The man pages look good.

The new commands should also have been added to the man page for
koha-common. I'll do a followup for that.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-01 22:03:13 -04:00

49 lines
1.7 KiB
Bash
Executable file

#!/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 <http://www.gnu.org/licenses/>.
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:/usr/share/koha/lib/C4/SIP"
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