X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Fbin%2Fkoha-pazpar2-ctl.sh;h=bcedfea8c8e964111d5031d91b5bffd06306e2ef;hb=ea1aa7a0d906d583375618e37be60e9f0d62d939;hp=90e7ce326cfd83e99954d63718c47a9c3c73ff62;hpb=f626f4c9c14c9df4052343d92c4677df13eb606e;p=koha-ffzg.git diff --git a/misc/bin/koha-pazpar2-ctl.sh b/misc/bin/koha-pazpar2-ctl.sh index 90e7ce326c..bcedfea8c8 100755 --- a/misc/bin/koha-pazpar2-ctl.sh +++ b/misc/bin/koha-pazpar2-ctl.sh @@ -1,7 +1,33 @@ #!/bin/bash + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +### BEGIN INIT INFO +# Provides: koha-pazpar-daemon +# Required-Start: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: PazPar2 server daemon for Koha +### END INIT INFO + USER=__KOHA_USER__ GROUP=__KOHA_GROUP__ -NAME=koha-pazpar2-ctl +DBNAME=__DB_NAME__ +NAME=koha-pazpar2-ctl.$DBNAME LOGDIR=__LOG_DIR__ ERRLOG=$LOGDIR/koha-pazpar2daemon.err STDOUT=$LOGDIR/koha-pazpar2daemon.log @@ -11,18 +37,23 @@ PAZPAR2SRV=/usr/sbin/pazpar2 test -f $PAZPAR2SRV || exit 0 +OTHERUSER='' +if [[ $EUID -eq 0 ]]; then + OTHERUSER="--user=$USER.$GROUP" +fi + case "$1" in start) echo "Starting PazPar2 Server" - daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP -- $PAZPAR2SRV -f $PAZPAR2_CONF + daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER -- $PAZPAR2SRV -f $PAZPAR2_CONF ;; stop) echo "Stopping PazPar2 Server" - daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --stop -- $PAZPAR2SRV -f $PAZPAR2_CONF + daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --stop -- $PAZPAR2SRV -f $PAZPAR2_CONF ;; restart) echo "Restarting the PazPar2 Server" - daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --restart -- $PAZPAR2SRV -f $PAZPAR2_CONF + daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --restart -- $PAZPAR2SRV -f $PAZPAR2_CONF ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart}"