133
技術社區[雲棲]
硬盤健康狀態監測
#!/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
最後更新:2017-08-21 10:32:50