Bug 10080: (followup) change two last instances of the old syspref name
[koha.git] / debian / koha-common.init
blob9a285a36acefbe74ad25764368424b4258cf833e
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: koha-common
4 # Required-Start: $remote_fs
5 # Required-Stop: $remote_fs
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
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).
12 ### END INIT INFO
14 # Author: Lars Wirzenius <lars@catalyst.net.nz>
16 # Do NOT "set -e"
18 # PATH should only include /usr/* if it runs after the mountnfs.sh script
19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC="Koha ILS"
21 NAME=daemonexecutablename
22 DAEMON=/usr/sbin/$NAME
23 DAEMON_ARGS="--options args"
24 PIDFILE=/var/run/$NAME.pid
25 SCRIPTNAME=/etc/init.d/$NAME
27 # Exit if the package is not installed
28 [ -x /usr/sbin/koha-start-zebra ] || exit 0
30 # Read configuration variable file if it is present
31 # [ -r /etc/default/$NAME ] && . /etc/default/$NAME
33 # Load the VERBOSE setting and other rcS variables
34 . /lib/init/vars.sh
36 # Define LSB log_* functions.
37 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
38 . /lib/lsb/init-functions
41 # Function that starts the daemon/service
43 do_start()
45 # We insure all required directories exist, including disabled ones.
46 koha-create-dirs $(koha-list)
47 koha-start-zebra $(koha-list --enabled)
48 koha-start-sip $(koha-list --enabled)
52 # Function that stops the daemon/service
54 do_stop()
56 # We stop everything, including disabled ones.
57 koha-stop-zebra $(koha-list) || true
58 koha-stop-sip $(koha-list) || true
62 # Function that sends a SIGHUP to the daemon/service
64 do_reload() {
65 koha-restart-zebra $(koha-list --enabled)
66 koha-stop-sip $(koha-list) || true
67 koha-start-sip $(koha-list --enabled)
70 case "$1" in
71 start)
72 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
73 do_start
74 case "$?" in
75 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
76 *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
77 esac
79 stop)
80 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
81 do_stop
82 case "$?" in
83 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
84 *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
85 esac
87 # status)
88 # status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
89 # ;;
90 #reload|force-reload)
92 # If do_reload() is not implemented then leave this commented out
93 # and leave 'force-reload' as an alias for 'restart'.
95 #log_daemon_msg "Reloading $DESC" "$NAME"
96 #do_reload
97 #log_end_msg $?
98 #;;
99 restart|force-reload)
101 # If the "reload" option is implemented then remove the
102 # 'force-reload' alias
104 log_daemon_msg "Restarting $DESC" "$NAME"
105 do_stop
106 case "$?" in
108 do_start
109 case "$?" in
110 0) log_end_msg 0 ;;
111 *) log_end_msg 1 ;; # Failed to start
112 esac
115 # Failed to stop
116 log_end_msg 1
118 esac
121 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
122 #echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
123 exit 3
125 esac