mdadm/mdmonitor.init
Doug Ledford c8f603e0a8 - New upstream release 3.0.3 (bz523320, bz527281)
- Update a couple internal patches
- Drop a patch in that was in Neil's tree for 3.0.3 that we had pulled for
    immediate use to resolve a bug
- Drop the endian patch because it no longer applied cleanly and all
    attempts to reproduce the original problem as reported in bz510605
    failed, even up to and including downloading the specific package that
    was reported as failing in that bug and trying to reproduce with it on
    both ppc and ppc64 hardware and with both ppc and ppc64 versions on the
    64bit hardware. Without a reproducer, it is impossible to determine if
    a rehashed patch to apply to this code would actually solve the
    problem, so remove the patch entirely since the original problem, as
    reported, was an easy to detect DOA issue where installing to a raid
    array was bound to fail on reboot and so we should be able to quickly
    and definitively tell if the problem resurfaces.
- Update the mdmonitor init script for LSB compliance (bz527957)
- Link from mdadm.static man page to mdadm man page (bz529314)
- Fix a problem in the raid-check script (bz523000)
- Fix the intel superblock handler so we can test on non-scsi block devices
2009-11-05 21:34:56 +00:00

102 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
#
# mdmonitor This starts, stops, and reloads the mdadm-based
# software RAID monitoring and management facility
#
# chkconfig: 2345 15 85
# description: software RAID monitoring and management
# config: /etc/mdadm.conf
#
# Copyright 2002 Red Hat, Inc.
#
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the MD software RAID monitor
# Description: The mdmonitor service checks the status of all software
# RAID arrays on the system. In the event that any of the arrays
# transition into a degraded state, it notifies the system
# administrator. Other options are available, see the mdadm.conf
# and mdadm man pages for possible ways to configure this service.
### END INIT INFO
PIDFILE=/var/run/mdadm/mdadm.pid
PATH=/sbin:/usr/sbin:$PATH
RETVAL=0
OPTIONS="--monitor --scan -f --pid-file=$PIDFILE"
prog=mdmonitor
# Source function library.
. /etc/rc.d/init.d/functions
usage ()
{
echo "Usage: service $prog {start|stop|status|restart|try-restart|force-reload}"
RETVAL=1
}
start ()
{
# (Re)start mdmon to take over monitoring of mdmon started from the initrd
if [ -f /dev/.mdadm/*.pid ]; then
origprog="$prog"; prog="mdmon"
action $"Starting $prog: " /sbin/mdmon /proc/mdstat /
prog="$origprog"
fi
# Make sure configuration file exists and has information we can use
# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
[ -f /etc/mdadm.conf ] || return 6
grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || return 6
if [ -f "$PIDFILE" ]; then
checkpid `cat $PIDFILE` && return 0
fi
echo -n $"Starting $prog: "
cd /
daemon --user=root mdadm ${OPTIONS}
ret=$?
[ $ret -eq "0" ] && touch /var/lock/subsys/$prog
echo
return $ret
}
stop ()
{
[ -f /var/lock/subsys/$prog ] || return 0
echo -n "Killing $prog: "
killproc mdadm
echo
rm -f /var/lock/subsys/$prog
}
restart ()
{
stop
start
}
condrestart ()
{
[ -e /var/lock/subsys/$prog ] && restart || return 0
}
case "$1" in
start|stop|restart|condrestart|try-restart|force-reload)
[ `id -u` != "0" ] && exit 4 ;;
esac
case "$1" in
start) start; RETVAL=$? ;;
stop) stop; RETVAL=$? ;;
status) status -p $PIDFILE $prog ; RETVAL=$? ;;
restart) restart; RETVAL=$? ;;
reload) RETVAL=3 ;;
condrestart|try-restart|force-reload) condrestart; RETVAL=$? ;;
*) usage ; RETVAL=2 ;;
esac
exit $RETVAL