Koha/misc/bin/koha-zebraqueue-ctl.sh
Galen Charlton f20a58181b kohabug 1776 - enable daemon controls scripts for 'dev' mode
The daemon control scripts (koha-zebra-ctl.sh, koha-zebraqueue-ctl.sh,
and koha-pazpar2-ctl.sh) are now copied and installed in a
runnable fashion for a 'dev'-mode install.  By default
they are installed in the bin subdirectory of the runtime
directory.

Also:

* the control scripts now work if the EUID is other
  than root (as would be expected for a 'dev' or 'single'
  install).
* Split the SCRIPT_DIR installation target into
  SCRIPT_DIR (scripts to copy regardless of install mode)
  and SCRIPT_NONDEV_DIR (scripts to copy to SCRIPT_DIR
  unless the install mode is 'dev').

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-21 18:17:32 -05:00

40 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
USER=__KOHA_USER__
GROUP=__KOHA_GROUP__
DBNAME=__DB_NAME__
NAME=koha-zebraqueue-ctl-$DBNAME
LOGDIR=__LOG_DIR__
PERL5LIB=__PERL_MODULE_DIR__
KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
ERRLOG=$LOGDIR/koha-zebraqueue.err
STDOUT=$LOGDIR/koha-zebraqueue.log
OUTPUT=$LOGDIR/koha-zebraqueue-output.log
export KOHA_CONF
export PERL5LIB
ZEBRAQUEUE=__SCRIPT_DIR__/zebraqueue_daemon.pl
test -f $ZEBRAQUEUE || exit 0
OTHERUSER=''
if [[ $EUID -eq 0 ]]; then
OTHERUSER="--user=$USER.$GROUP"
fi
case "$1" in
start)
echo "Starting Zebraqueue Daemon"
daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF
;;
stop)
echo "Stopping Zebraqueue Daemon"
daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER --stop -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF
;;
restart)
echo "Restarting the Zebraqueue Daemon"
daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER --restart -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
exit 1
;;
esac