rendered paste body#!/bin/sh
#
# Start the RAID monitor daemon for all active md arrays if desired.
#
# Copyright (c) 2001-2004 Mario Jou/3en <joussen@debian.org>
# Distributable under the terms of the GNU GPL version 2.
MDADM=/sbin/mdadm
DEBIANCONFIG=/etc/default/mdadm
PIDFILE=/var/run/mdadm.pid
test -x $MDADM || exit 0
test -f /proc/mdstat || exit 0
MAIL_TO=root
START_DAEMON=true
test -f $DEBIANCONFIG && . $DEBIANCONFIG
case "$1" in
start)
if [ "x$START_DAEMON" = "xtrue" ] ; then
echo -n "Starting RAID monitor daemon: mdadm -F"
start-stop-daemon -S -q -p $PIDFILE -x $MDADM -- -F -i $PIDFILE -m $MAIL_TO -f -s
echo "."
fi
;;
stop)
if [ -f $PIDFILE ] ; then
echo -n "Stopping RAID monitor daemon: mdadm -F"
start-stop-daemon -K -q -p $PIDFILE -x $MDADM
rm -f $PIDFILE
echo "."
fi
;;
restart|reload|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0