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 Zebra server for each Koha instance
9 # Description: For each enabled Koha instance on this host,
10 # as listed by "koha-list --enabled", start a Zebra
11 # server (using koha-start-zebra).
14 # Author: Lars Wirzenius <lars@catalyst.net.nz>
18 # PATH should only include /usr/* if it runs after the mountnfs.sh script
19 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
22 SCRIPTNAME
=/etc
/init.d
/$NAME
24 # Exit if the package is not installed
25 [ -x /usr
/sbin
/koha-start-zebra
] ||
exit 0
27 # Read configuration variable file if it is present
28 if [ -r /etc
/default
/$NAME ]; then
31 elif [ -r /etc
/sysconfig
/$NAME ]; then
33 .
/etc
/sysconfig
/$NAME
36 # Load the VERBOSE setting and other rcS variables
39 # Define LSB log_* functions.
40 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
41 .
/lib
/lsb
/init-functions
43 # include helper functions
44 if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
45 .
"/usr/share/koha/bin/koha-functions.sh"
47 echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
52 # Function that starts the daemon/service
56 # We insure all required directories exist, including disabled ones.
57 koha-create-dirs $
(koha-list
)
58 koha-start-zebra $
(koha-list
--enabled)
59 koha-start-sip $
(koha-list
--enabled)
60 koha-plack
--start $
(koha-list
--enabled --plack)
62 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
63 koha-indexer
--start --quiet $
(koha-list
--enabled)
68 # Function that stops the daemon/service
72 # We stop everything, including disabled ones.
73 koha-stop-zebra $
(koha-list
) || true
74 koha-stop-sip $
(koha-list
) || true
75 koha-plack
--stop --quiet $
(koha-list
--enabled --plack)
77 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
78 koha-indexer
--stop --quiet $
(koha-list
--enabled)
83 # Function that sends a SIGHUP to the daemon/service
86 koha-restart-zebra $
(koha-list
--enabled)
87 koha-stop-sip $
(koha-list
) || true
88 koha-start-sip $
(koha-list
--enabled)
89 koha-plack
--restart --quiet $
(koha-list
--enabled --plack)
91 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
92 koha-indexer
--restart --quiet $
(koha-list
--enabled)
97 # Function that shows the status of the zebrasrv daemon for
102 for instance
in $
(koha-list
--enabled); do
104 log_daemon_msg
"Zebra server running for instance $instance"
106 if is_zebra_running
$instance ; then
115 # Function that shows the status of the SIP server daemon for
120 for instance
in $
(koha-list
--enabled --sip); do
122 log_daemon_msg
"SIP server running for instance $instance"
124 if is_sip_running
$instance ; then
133 # Function that shows the status of the Plack server daemon for
138 for instance
in $
(koha-list
--enabled --plack); do
140 log_daemon_msg
"Plack server running for instance ${instance}"
142 if is_plack_running
$instance ; then
152 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
155 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
156 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
160 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
163 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
164 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
167 restart|force-reload
)
169 # If the "reload" option is implemented then remove the
170 # 'force-reload' alias
172 log_daemon_msg
"Restarting $DESC" "$NAME"
179 *) log_end_msg
1 ;; # Failed to start
194 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2