3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 # Provides: koha-pazpar-daemon
20 # Required-Start: $syslog $remote_fs
21 # Required-Stop: $syslog $remote_fs
22 # Default-Start: 2 3 4 5
24 # Short-Description: PazPar2 server daemon for Koha
30 NAME=koha-pazpar2-ctl.$DBNAME
32 ERRLOG=$LOGDIR/koha-pazpar2daemon.err
33 STDOUT=$LOGDIR/koha-pazpar2daemon.log
34 OUTPUT=$LOGDIR/koha-pazpar2daemon-output.log
35 PAZPAR2_CONF=__PAZPAR2_CONF_DIR__/pazpar2.xml
36 PAZPAR2SRV=/usr/sbin/pazpar2
38 test -f $PAZPAR2SRV || exit 0
41 if [[ $EUID -eq 0 ]]; then
42 OTHERUSER="--user=$USER.$GROUP"
47 echo "Starting PazPar2 Server"
48 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER -- $PAZPAR2SRV -f $PAZPAR2_CONF
51 echo "Stopping PazPar2 Server"
52 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --stop -- $PAZPAR2SRV -f $PAZPAR2_CONF
55 echo "Restarting the PazPar2 Server"
56 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --restart -- $PAZPAR2SRV -f $PAZPAR2_CONF
59 echo "Usage: /etc/init.d/$NAME {start|stop|restart}"