3 # Provides: koha-common
4 # Required-Start: $remote_fs memcached
5 # Required-Stop: $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Start required services for each Koha instance
9 # Description: For each enabled Koha instance on this host,
11 # - a Zebra server (using koha-zebra)
12 # - a Plack server (using koha-plack)
13 # - a SIP server (using koha-sip)
14 # - a Z3950 server (using koha-z3950-responder)
17 # Author: Lars Wirzenius <lars@catalyst.net.nz>
21 # PATH should only include /usr/* if it runs after the mountnfs.sh script
22 PATH=/sbin:/usr/sbin:/bin:/usr/bin
25 SCRIPTNAME=/etc/init.d/$NAME
27 # Exit if the package is not installed
28 [ -x /usr/sbin/koha-zebra ] || exit 0
30 # Read configuration variable file if it is present
31 if [ -r /etc/default/$NAME ]; then
34 elif [ -r /etc/sysconfig/$NAME ]; then
36 . /etc/sysconfig/$NAME
39 # Load the VERBOSE setting and other rcS variables
42 # Define LSB log_* functions.
43 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
44 . /lib/lsb/init-functions
46 # include helper functions
47 if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
48 . "/usr/share/koha/bin/koha-functions.sh"
50 echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
55 # Function that starts the daemon/service
59 # We insure all required directories exist, including disabled ones.
60 koha-create-dirs $(koha-list)
61 koha-zebra --start $(koha-list --enabled)
62 koha-sip --start $(koha-list --enabled --sip)
63 koha-plack --start $(koha-list --enabled --plack)
64 koha-z3950-responder --start --quiet $(koha-list --enabled --z3950)
66 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
67 koha-indexer --start --quiet $(koha-list --enabled)
72 # Function that stops the daemon/service
76 # We stop everything, including disabled ones.
77 koha-zebra --stop $(koha-list) || true
78 koha-sip --stop $(koha-list --sip)
79 koha-plack --stop --quiet $(koha-list --enabled --plack)
80 koha-z3950-responder --stop --quiet $(koha-list --enabled --z3950)
82 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
83 koha-indexer --stop --quiet $(koha-list --enabled)
88 # Function that sends a SIGHUP to the daemon/service
91 koha-zebra --restart $(koha-list --enabled)
92 koha-sip --restart $(koha-list --enabled --sip)
93 koha-plack --restart --quiet $(koha-list --enabled --plack)
94 koha-z3950-responder --restart --quiet $(koha-list --enabled --z3950)
96 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
97 koha-indexer --restart --quiet $(koha-list --enabled)
102 # Function that shows the status of the zebrasrv daemon for
107 for instance in $(koha-list --enabled); do
109 log_daemon_msg "Zebra server running for instance $instance"
111 if is_zebra_running $instance ; then
120 # Function that shows the status of the SIP server daemon for
125 for instance in $(koha-list --enabled --sip); do
127 log_daemon_msg "SIP server running for instance $instance"
129 if is_sip_running $instance ; then
138 # Function that shows the status of the Plack server daemon for
143 for instance in $(koha-list --enabled --plack); do
145 log_daemon_msg "Plack server running for instance ${instance}"
147 if is_plack_running $instance ; then
156 # Function that shows the status of the Z39.50/SRU server daemon for
161 for instance in $(koha-list --enabled --z3950); do
163 log_daemon_msg "Z39.50/SRU daemon running for instance ${instance}"
165 if is_z3950_running $instance ; then
175 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
178 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
179 *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
183 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
186 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
187 *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
190 restart|force-reload)
192 # If the "reload" option is implemented then remove the
193 # 'force-reload' alias
195 log_daemon_msg "Restarting $DESC" "$NAME"
202 *) log_end_msg 1 ;; # Failed to start
218 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2