Email Example: File Server Stats

#!/bin/bash

mailSubject="$HOSTNAME Report: `date +%Y-%m-%d--%H-%M-%S`"
mailTo="[email protected]"
mailMessage="/tmp/storage_stats"

stats="/tmp/stats_tmp"
df -hT > $stats
cat $stats > $mailMessage
echo -e >> $mailMessage

find /backup/ -maxdepth 1 -type d | xargs du -hs > $stats
cat $stats >> $mailMessage
echo -e >> $mailMessage

who -b > $stats
cat $stats >> $mailMessage
echo -e >> $mailMessage

uptime > $stats
cat $stats >> $mailMessage
echo -e >> $mailMessage

cat $mailMessage | mail -s "$mailSubject" "$mailTo"