3 # Provides: koha-common
4 # Required-Start: $remote_fs
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-start-sip)
16 # Author: Lars Wirzenius <lars@catalyst.net.nz>
20 # PATH should only include /usr/* if it runs after the mountnfs.sh script
21 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
24 SCRIPTNAME
=/etc
/init.d
/$NAME
26 # Exit if the package is not installed
27 [ -x /usr
/sbin
/koha-zebra
] ||
exit 0
29 # Read configuration variable file if it is present
30 if [ -r /etc
/default
/$NAME ]; then
33 elif [ -r /etc
/sysconfig
/$NAME ]; then
35 .
/etc
/sysconfig
/$NAME
38 # Load the VERBOSE setting and other rcS variables
41 # Define LSB log_* functions.
42 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43 .
/lib
/lsb
/init-functions
45 # include helper functions
46 if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
47 .
"/usr/share/koha/bin/koha-functions.sh"
49 echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
54 # Function that starts the daemon/service
58 # We insure all required directories exist, including disabled ones.
59 koha-create-dirs $
(koha-list
)
60 koha-zebra
--start $
(koha-list
--enabled)
61 koha-start-sip $
(koha-list
--enabled)
62 koha-plack
--start $
(koha-list
--enabled --plack)
64 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
65 koha-indexer
--start --quiet $
(koha-list
--enabled)
70 # Function that stops the daemon/service
74 # We stop everything, including disabled ones.
75 koha-zebra
--stop $
(koha-list
) || true
76 koha-stop-sip $
(koha-list
) || true
77 koha-plack
--stop --quiet $
(koha-list
--enabled --plack)
79 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
80 koha-indexer
--stop --quiet $
(koha-list
--enabled)
85 # Function that sends a SIGHUP to the daemon/service
88 koha-zebra
--restart $
(koha-list
--enabled)
89 koha-stop-sip $
(koha-list
) || true
90 koha-start-sip $
(koha-list
--enabled)
91 koha-plack
--restart --quiet $
(koha-list
--enabled --plack)
93 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
94 koha-indexer
--restart --quiet $
(koha-list
--enabled)
99 # Function that shows the status of the zebrasrv daemon for
104 for instance
in $
(koha-list
--enabled); do
106 log_daemon_msg
"Zebra server running for instance $instance"
108 if is_zebra_running
$instance ; then
117 # Function that shows the status of the SIP server daemon for
122 for instance
in $
(koha-list
--enabled --sip); do
124 log_daemon_msg
"SIP server running for instance $instance"
126 if is_sip_running
$instance ; then
135 # Function that shows the status of the Plack server daemon for
140 for instance
in $
(koha-list
--enabled --plack); do
142 log_daemon_msg
"Plack server running for instance ${instance}"
144 if is_plack_running
$instance ; then
154 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
157 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
158 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
162 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
165 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
166 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
169 restart|force-reload
)
171 # If the "reload" option is implemented then remove the
172 # 'force-reload' alias
174 log_daemon_msg
"Restarting $DESC" "$NAME"
181 *) log_end_msg
1 ;; # Failed to start
196 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2