- #!/bin/sh
- EMAIL="admin@srv-home.local"
- DEVICES="/dev/ad4 /dev/ad6"
- SMARTCTL=`whereis smartctl | awk '{print $2}'`
- if [ -z "${DEVICES}" ]; then
- echo '$DEVICES is empty'
- elif [ ! -x "${SMARTCTL}" ]; then
- echo "smartctl not found"
- else
- if [ -f /tmp/daily.sendsmart ]; then
- rm -f /tmp/daily.sendsmart
- fi
- for devs in $DEVICES; do
- touch /tmp/daily.sendsmart
- $SMARTCTL -a $devs > /tmp/daily.sendsmart
- cat /tmp/daily.sendsmart | mail -s "S.M.A.R.T. $devs" $EMAIL
- rm -f /tmp/daily.sendsmart
- sleep 10
- done
- fi