Bug 9841 - Improve the link from the "logged in as mysql-user"-warning
[koha.git] / misc / bin / koha-zebra-ctl.sh
blob397eb19c6e02d1fbd2310daa55dd10bf6c8b2aba
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-zebra-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: Zebra server daemon for Koha indexing
25 ### END INIT INFO
27 USER=__KOHA_USER__
28 GROUP=__KOHA_GROUP__
29 DBNAME=__DB_NAME__
30 NAME=koha-zebra-ctl.$DBNAME
31 LOGDIR=__LOG_DIR__
32 ERRLOG=$LOGDIR/koha-zebradaemon.err
33 STDOUT=$LOGDIR/koha-zebradaemon.log
34 OUTPUT=$LOGDIR/koha-zebradaemon-output.log
35 KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
36 RUNDIR=__ZEBRA_RUN_DIR__
37 LOCKDIR=__ZEBRA_LOCK_DIR__
38 # you may need to change this depending on where zebrasrv is installed
39 ZEBRASRV=__PATH_TO_ZEBRA__/zebrasrv
40 ZEBRAOPTIONS="-v none,fatal,warn"
42 test -f $ZEBRASRV || exit 0
44 OTHERUSER=''
45 if [[ $EUID -eq 0 ]]; then
46 OTHERUSER="--user=$USER.$GROUP"
49 case "$1" in
50 start)
51 echo "Starting Zebra Server"
53 # create run and lock directories if needed;
54 # /var/run and /var/lock are completely cleared at boot
55 # on some platforms
56 if [[ ! -d $RUNDIR ]]; then
57 umask 022
58 mkdir -p $RUNDIR
59 if [[ $EUID -eq 0 ]]; then
60 chown $USER:$GROUP $RUNDIR
63 if [[ ! -d $LOCKDIR ]]; then
64 umask 022
65 mkdir -p $LOCKDIR
66 mkdir -p $LOCKDIR/biblios
67 mkdir -p $LOCKDIR/authorities
68 if [[ $EUID -eq 0 ]]; then
69 chown -R $USER:$GROUP $LOCKDIR
73 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER -- $ZEBRASRV $ZEBRAOPTIONS -f $KOHA_CONF
75 stop)
76 echo "Stopping Zebra Server"
77 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER --stop -- $ZEBRASRV -f $KOHA_CONF
79 restart)
80 echo "Restarting the Zebra Server"
81 daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 $OTHERUSER --restart -- $ZEBRASRV -f $KOHA_CONF
84 echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
85 exit 1
87 esac