#!/bin/bash # Program: Monitor hard disk and shutdown system if temp >= 35 # http://www.cyberciti.biz/tips/howto-monitor-hard-drive-temperature.html # Author: nixCraft < vivek @ nixCraft DOT com > ################################################ HDDS="/dev/sda /dev/sdb /dev/sdc" # my hdd HDT=/usr/sbin/hddtemp LOG=/usr/bin/logger DOWN=/sbin/shutdown ALERT_LEVEL=35 for disk in $HDDS do if [ -b $disk ]; then HDTEMP=$($HDT $disk | awk '{ print $4}' | awk -F '°' '{ print $1}') if [ $HDTEMP -ge $ALERT_LEVEL ]; then $LOG "System going down as hard disk : $disk temperature $HDTEMP°C crossed its limit" sync;sync # add email code, make sure you add 2m delay # mail -s "HDD temperature >= 35 @ $(hostname)" you@domain.com