Lines 1-68
Link Here
|
1 |
#!/bin/sh |
|
|
2 |
# |
3 |
# koha-start-sip -- Start SIP server for named Koha instance |
4 |
# Copyright 2012 Catalyst IT, Ltd |
5 |
# |
6 |
# This program is free software: you can redistribute it and/or modify |
7 |
# it under the terms of the GNU General Public License as published by |
8 |
# the Free Software Foundation, either version 3 of the License, or |
9 |
# (at your option) any later version. |
10 |
# |
11 |
# This program is distributed in the hope that it will be useful, |
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
# GNU General Public License for more details. |
15 |
# |
16 |
# You should have received a copy of the GNU General Public License |
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 |
|
19 |
set -e |
20 |
|
21 |
# Read configuration variable file if it is present |
22 |
[ -r /etc/default/koha-common ] && . /etc/default/koha-common |
23 |
|
24 |
# include helper functions |
25 |
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then |
26 |
. "/usr/share/koha/bin/koha-functions.sh" |
27 |
else |
28 |
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 |
29 |
exit 1 |
30 |
fi |
31 |
|
32 |
for name in "$@" |
33 |
do |
34 |
if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; |
35 |
then |
36 |
echo "No such instance: ${name}" > /dev/stderr |
37 |
continue; |
38 |
fi |
39 |
[ -e /etc/koha/sites/${name}/SIPconfig.xml ] || continue |
40 |
echo "Starting SIP server for $name" |
41 |
mkdir -p /var/run/koha/${name} |
42 |
chown "${name}-koha:${name}-koha" /var/run/koha/${name} |
43 |
|
44 |
adjust_paths_dev_install $name |
45 |
export KOHA_CONF PERL5LIB |
46 |
KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml |
47 |
# PERL5LIB has been read already |
48 |
if [ "$DEV_INSTALL" = "" ]; then |
49 |
LIBDIR=$KOHA_HOME/lib |
50 |
else |
51 |
LIBDIR=$KOHA_HOME |
52 |
fi |
53 |
|
54 |
daemon \ |
55 |
--name="$name-koha-sip" \ |
56 |
--errlog="/var/log/koha/$name/sip-error.log" \ |
57 |
--stdout="/var/log/koha/$name/sip.log" \ |
58 |
--output="/var/log/koha/$name/sip-output.log" \ |
59 |
--verbose=1 \ |
60 |
--respawn \ |
61 |
--delay=30 \ |
62 |
--pidfiles="/var/run/koha/${name}" \ |
63 |
--user="$name-koha.$name-koha" \ |
64 |
-- \ |
65 |
perl \ |
66 |
"$LIBDIR/C4/SIP/SIPServer.pm" \ |
67 |
"/etc/koha/sites/${name}/SIPconfig.xml" |
68 |
done |