3
# Start the MD monitor daemon for all active MD arrays if desired.
5
# Copyright © 2001-2005 Mario Jou/3en <joussen@debian.org>
6
# Copyright © 2005-2009 Martin F. Krafft <madduck@debian.org>
7
# Distributable under the terms of the GNU GPL version 2.
11
# Required-Start: $local_fs $syslog mdadm-raid
12
# Required-Stop: $local_fs $syslog sendsigs mdadm-raid
13
# Default-Start: 2 3 4 5
15
# Short-Description: MD monitoring daemon
16
# Description: mdadm provides a monitor mode, in which it will scan for
17
# problems with the MD devices. If a problem is found, the
18
# administrator is alerted via email, or a custom script is
27
PIDFILE=$RUNDIR/monitor.pid
28
DEBIANCONFIG=/etc/default/mdadm
30
test -x "$MDADM" || exit 0
32
test -f /proc/mdstat || exit 0
35
test -f $DEBIANCONFIG && . $DEBIANCONFIG
37
. /lib/lsb/init-functions
42
[Yy]es|[Yy]|1|[Tt]|[Tt]rue) return 0;;
49
if is_true $START_DAEMON; then
50
log_daemon_msg "Starting MD monitoring service" "mdadm --monitor"
53
start-stop-daemon -S -p $PIDFILE -x $MDADM -- \
54
--monitor --pid-file $PIDFILE --daemonise --scan ${DAEMON_OPTIONS:-}
58
if [ "$(echo $RUNDIR/md[0-9]*.pid)" != "$RUNDIR/md[0-9]*.pid" ]; then
59
log_daemon_msg "Restarting MD external metadata monitor" "mdmon --takeover --all"
61
$MDMON --takeover --all
67
if [ -f $PIDFILE ] ; then
68
log_daemon_msg "Stopping MD monitoring service" "mdadm --monitor"
70
start-stop-daemon -K -p $PIDFILE -x $MDADM
75
for file in $RUNDIR/md[0-9]*.pid ; do
76
[ ! -f "$file" ] && continue
77
ln -sf $file /run/sendsigs.omit.d/mdmon-${file##*/}
81
status_of_proc -p $PIDFILE "$MDADM" "mdadm" && exit 0 || exit $?
83
restart|reload|force-reload)
88
echo "Usage: ${0:-} {start|stop|status|restart|reload|force-reload}" >&2