#!/usr/local/bin/bash # # test if the array status contains READY when not, it sends you an email. # you can use 'v' as first argument, it will print the status. # made by Erik Jan Jonkers 2002 e.jonkers [at] datact.nl # # 25 * * * * /usr/local/sbin/testraid # status='READY' host=`hostname -s` result=`/sbin/atacontrol status ar0` if [ "$1" == 'v' ]; then echo "I'am $host" echo "status: $result" fi statusresult=`echo $result | grep $status` if ! [ "$statusresult" ]; then echo "$result Server $host" | mail -s "Raid Message" raid@youremail.com fi