#!/bin/zsh

. $(dirname $0:A)/func.zsh
check_root

MAX_TEMP=$1

for i in `ls -1 /dev/disk/by-id/ | grep -v -P "^wwn-|\-part\d$|md-name|md-uuid"`; do
  DRIVE="/dev/disk/by-id/$i"
  TEMP=$(/usr/sbin/hddtemp -n $DRIVE 2>/dev/null)
  if [ "$TEMP" != "" ]; then
    if [ $TEMP -gt $MAX_TEMP ]; then logger "$DRIVE temp at $TEMP"; fi
  fi
done