#!/bin/bash
doit()
{
    F=`builtin cd /sys/devices/virtual/block/; echo md*`
    for RAID in $F; do
	if [ -e "/sys/devices/virtual/block/$RAID/md/array_state" ]; then
	    read v < /sys/devices/virtual/block/$RAID/md/array_state
	    if [ "$v" == "inactive" ]; then
		echo "md-run-timer $RAID is inactive, attempting to start" > /dev/kmsg
		/usr/sbin/mdadm -R /dev/$RAID > /dev/kmsg
		sleep 1
	    fi
	fi
    done
    unset F
    unset RAID
    unset v
}
#-----------------------------------------------------------------------------
(sleep 15; doit || true ) &
#-----------------------------------------------------------------------------
exit 0
#-----------------------------------------------------------------------------
