Bug 20920: Add missing dependency on CGI::Compile
[koha.git] / misc / bin / koha-pazpar2-ctl.sh
blob6db96dce31c96c7bfcbc572c309ba7cc534fa7c3
1 #!/bin/bash
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>.
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