mdadm/mdmonitor.init
2005-05-16 22:03:20 +00:00

76 lines
1.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.
PATH=/sbin:/usr/sbin:$PATH
RETVAL=0
OPTIONS="--monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid"
prog=mdmonitor
# Source function library.
. /etc/rc.d/init.d/functions
# 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 ] || exit 0
grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || exit 0
usage ()
{
echo "Usage: service $prog {start|stop|status|restart|condrestart}"
RETVAL=1
}
start ()
{
echo -n $"Starting $prog: "
daemon --check --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
}
case "$1" in
start) start ;;
stop) stop ;;
status) status mdadm ;;
restart|reload) restart ;;
condrestart) condrestart ;;
*) usage ;;
esac
exit $RETVAL