#!/bin/sh # # Start the RAID monitor daemon for all active md arrays if desired. # # based on init.d script of Mario Jou/3en # modified for ALTLinux by LAKostis # # chkconfig: 345 90 10 # description: mdadm monitors all active md arrays # processname: mdadm # pidfile: /var/run/mdadm.pid # Do not load RH compatibility interface. WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions BINARY=/usr/sbin/mdadm CONFIG=/etc/mdadm.conf LOCKFILE=/var/lock/subsys/mdadm MAIL_TO=root ARRAYS="`sed -ne 's/^\(md[[:digit:]]\+\) : active.*/\1/p' /proc/mdstat`" RETVAL=0 # if overriding these is needed SourceIfNotEmpty /etc/sysconfig/mdadm start() { if [ -n "$ARRAYS" ] ; then if [ -e /dev/.devfsd ] ; then ARRAYS="`echo $ARRAYS | sed -e 's%md%/dev/md/%g'`" else ARRAYS="`echo $ARRAYS | sed -e 's%md%/dev/md%g'`" fi start_daemon --lockfile "$LOCKFILE" --expect-user root -- \ $BINARY -F -f -m $MAIL_TO $ARRAYS else echo " no arrays for monitoring were found." fi RETVAL=$? return $RETVAL } stop() { stop_daemon --lockfile "$LOCKFILE" --expect-user root -- mdadm RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) restart ;; restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then reload fi ;; status) status --expect-user root -- mdadm RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" RETVAL=1 esac exit $RETVAL