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
44 # Function that starts the daemon/service
48 # We insure all required directories exist, including disabled ones.
49 koha-create-dirs $
(koha-list
)
50 koha-start-zebra $
(koha-list
--enabled)
51 koha-start-sip $
(koha-list
--enabled)
53 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
54 koha-indexer
--start --quiet $
(koha-list
--enabled)
59 # Function that stops the daemon/service
63 # We stop everything, including disabled ones.
64 koha-stop-zebra $
(koha-list
) || true
65 koha-stop-sip $
(koha-list
) || true
67 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
68 koha-indexer
--stop --quiet $
(koha-list
--enabled)
73 # Function that sends a SIGHUP to the daemon/service
76 koha-restart-zebra $
(koha-list
--enabled)
77 koha-stop-sip $
(koha-list
) || true
78 koha-start-sip $
(koha-list
--enabled)
80 if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
81 koha-indexer
--restart --quiet $
(koha-list
--enabled)
86 # Function that checks zebrasrv is running for the specified instance
92 if daemon
--name="$instancename-koha-zebra" \
93 --user="$instancename-koha.$instancename-koha" \
102 # Function that checks SIP server is running for the specified instance
106 local instancename
=$1
108 if daemon
--name="$instancename-koha-sip" \
109 --pidfiles="/var/run/koha/$instancename" \
110 --user="$instancename-koha.$instancename-koha" \
119 # Function that shows the status of the zebrasrv daemon for
124 for instance
in $
(koha-list
--enabled); do
126 log_daemon_msg
"Zebra server running for instace $instance"
128 if is_zebra_running
$instance ; then
137 # Function that shows the status of the SIP server daemon for
142 for instance
in $
(koha-list
--enabled --sip); do
144 log_daemon_msg
"SIP server running for instace $instance"
146 if is_sip_running
$instance ; then
156 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
159 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
160 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
164 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
167 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
168 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
171 restart|force-reload
)
173 # If the "reload" option is implemented then remove the
174 # 'force-reload' alias
176 log_daemon_msg
"Restarting $DESC" "$NAME"
183 *) log_end_msg
1 ;; # Failed to start
197 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2