Bug 12365: Notes for rules
[koha.git] / debian / scripts / koha-start-sip
blob7f4f8182bd666459bc27d62d43bad9286ec7c14f
1 #!/bin/sh
3 # koha-start-sip -- Start SIP server for named Koha instance
4 # Copyright 2012 Catalyst IT, Ltd
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.
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.
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/>.
19 set -e
21 # Read configuration variable file if it is present
22 [ -r /etc/default/koha-common ] && . /etc/default/koha-common
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
32 for name in "$@"
34 if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
35 then
36 echo "No such instance: ${name}" > /dev/stderr
37 continue;
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}
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
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