#!/bin/sh ######################################## # Description: This script is used to send email notifications for the # smartmontools service on server.test.com. # Required files: hostname, date, printf, msmtp # Last modified: March 22, 2010 ######################################## #################### # Set variables #################### hostname=/bin/hostname host=`$hostname -s` date=/bin/date current_day=`$date +%m/%d/%y` current_time=`$date +%H:%M:%S` printf=/usr/bin/printf from="Test " recipient="$SMARTD_ADDRESS" msmtp=/usr/local/bin/msmtp msmtp_config=/var/etc/msmtp.conf body="$SMARTD_FULLMESSAGE" subject="System Alert: Smartd warning ($SMARTD_FAILTYPE) on $host [$current_day $current_time]" $printf "From: $from\nTo: $recipient\nSubject: $subject\n\n$body" | $msmtp --file=$msmtp_config -t exit 0