#!/bin/bash

# Simple routine to check SoftRAID status
# 0 if no problems, >0 if there's a problem

# Check if /proc/mdstat exists
if [ -f /proc/mdstat ]; then
	# If so, see if any array volumes have an underscore
	# present (indicating a down drive)
        cat /proc/mdstat | grep 'blocks' | grep -c '_'
else
	# If no mdstat file, just respond back OK
        printf "0"
fi
