#!/bin/bash for dev in `grep "^md.*: active" /proc/mdstat | cut -f 1 -d ' '`; do [ -f /sys/block/$dev/md/sync_action ] && \ echo "check" > /sys/block/$dev/md/sync_action done