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)
55 # Function that stops the daemon/service
59 # We stop everything, including disabled ones.
60 koha-stop-zebra $
(koha-list
) || true
61 koha-stop-sip $
(koha-list
) || true
65 # Function that sends a SIGHUP to the daemon/service
68 koha-restart-zebra $
(koha-list
--enabled)
69 koha-stop-sip $
(koha-list
) || true
70 koha-start-sip $
(koha-list
--enabled)
74 # Function that checks zebrasrv is running for the specified instance
80 if daemon
--name="$instancename-koha-zebra" \
81 --user="$instancename-koha.$instancename-koha" \
90 # Function that checks SIP server is running for the specified instance
96 if daemon
--name="$instancename-koha-sip" \
97 --pidfiles="/var/run/koha/$instancename" \
98 --user="$instancename-koha.$instancename-koha" \
107 # Function that shows the status of the zebrasrv daemon for
112 for instance
in $
(koha-list
--enabled); do
114 log_daemon_msg
"Zebra server running for instace $instance"
116 if is_zebra_running
$instance ; then
125 # Function that shows the status of the SIP server daemon for
130 for instance
in $
(koha-list
--enabled --sip); do
132 log_daemon_msg
"SIP server running for instace $instance"
134 if is_sip_running
$instance ; then
144 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
147 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
148 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
152 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
155 0) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
156 *) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
159 restart|force-reload
)
161 # If the "reload" option is implemented then remove the
162 # 'force-reload' alias
164 log_daemon_msg
"Restarting $DESC" "$NAME"
171 *) log_end_msg
1 ;; # Failed to start
185 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2