閱讀133 返回首頁    go 技術社區[雲棲]


硬盤健康狀態監測

#!/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

  上一篇:go  PostgreSQL服務器管理:在Windows上從源代碼安裝
  下一篇:go  政府安全資訊精選 2017年第四期:聚焦美國網絡安全新動態