| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /etc/cron.weekly/ |
Upload File : |
#!/bin/bash
#
# This script reads it's configuration from /etc/sysconfig/raid-check
# Please use that file to enable/disable this script or to set the
# type of check you wish performed.
[ -f /etc/sysconfig/raid-check ] || exit 0
. /etc/sysconfig/raid-check
[ "$ENABLED" != "yes" ] && exit 0
case "$CHECK" in
check) ;;
repair) ;;
*) exit 0;;
esac
dev_list=""
for dev in `grep "^md.*: active" /proc/mdstat | cut -f 1 -d ' '`; do
echo $SKIP_DEVS | grep -w $dev >/dev/null 2>&1 && continue
if [ -f /sys/block/$dev/md/sync_action ]; then
array_state=`cat /sys/block/$dev/md/array_state`
sync_action=`cat /sys/block/$dev/md/sync_action`
# Only perform the checks on idle, healthy arrays
if [ "$array_state" = "clean" -a "$sync_action" = "idle" ]; then
check=""
echo $REPAIR_DEVS | grep -w $dev >/dev/null 2>&1 && \
check="repair"
echo $CHECK_DEVS | grep -w $dev >/dev/null 2>&1 \
&& check="check"
[ -z "$check" ] && check=$CHECK
echo "$check" > /sys/block/$dev/md/sync_action
[ "$check" = "check" ] && dev_list="$dev_list $dev"
fi
fi
done
if [ -n "$dev_list" ]; then
checking=1
while [ $checking -ne 0 ]
do
sleep 3
checking=0
for dev in $dev_list; do
sync_action=`cat /sys/block/$dev/md/sync_action`
if [ "$sync_action" != "idle" ]; then
checking=1
fi
done
done
for dev in $dev_list; do
mismatch_cnt=`cat /sys/block/$dev/md/mismatch_cnt`
if [ "$mismatch_cnt" -ne 0 ]; then
echo "WARNING: mismatch_cnt is not 0 on /dev/$dev"
fi
done
fi