Bug 11633 Return Correct status if patron blocked by fines
[koha.git] / misc / bin / koha-pazpar2-ctl.sh
blobbcedfea8c8e964111d5031d91b5bffd06306e2ef
1 #!/bin/bash
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
8 # version.
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
18 ### BEGIN INIT INFO
19 # Provides: koha-pazpar-daemon
20 # Required-Start: $syslog $remote_fs
21 # Required-Stop: $syslog $remote_fs
22 # Default-Start: 2 3 4 5
23 # Default-Stop: 0 1 6
24 # Short-Description: PazPar2 server daemon for Koha
25 ### END INIT INFO
27 USER=__KOHA_USER__
28 GROUP=__KOHA_GROUP__
29 DBNAME=__DB_NAME__
30 NAME=koha-pazpar2-ctl.$DBNAME
31 LOGDIR=__LOG_DIR__
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
40 OTHERUSER=''
41 if [[ $EUID -eq 0 ]]; then
42 OTHERUSER="--user=$USER.$GROUP"
45 case "$1" in
46 start)
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
50 stop)
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
54 restart)
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}"
60 exit 1
62 esac