#!/bin/bash
# 需要安装smartmontools 软件
Ip=`ifconfig | grep "inet addr:.* Bcast" | awk -F : '{print $2}'|sed -e s/Bcast//g`
Disk="/dev/sd"
for disk in {a..l}
do
smartctl -H $Disk"$disk" >>/dev/null
if [ "$?" -eq "0" ];then
echo "$Disk$disk Health Status: OK"
else
echo "$Ip---$Disk$disk Health Status: Fail"|mail -s "Disk not read" wgy.wuhan@qq.com
fi done