3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
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}"