Skip to content

Instantly share code, notes, and snippets.



Created Apr 7, 2013
What would you like to do?
smartd mail script
# send smartd mail plus serial and smartctl -a.
# usage: -m root -M exec /path/to/this/script
# test with: -m root -M exec /path/to/this/script -M test and smartctl -q onecheck afterwards.
# message is passed via stdin
cat > $tempfile
# append smartctl -a
/usr/sbin/smartctl -a -d "$SMARTD_DEVICETYPE" "$SMARTD_DEVICE" >> $tempfile
SERIAL="$(hdparm -I "$SMARTD_DEVICE" | awk '/Serial Number/ { print $3 }')"
rm -f "$tempfile"
# And exit
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment