Last active
June 15, 2016 22:12
-
-
Save stampycode/264e0349a031309072d593ff2ed228ab to your computer and use it in GitHub Desktop.
emails a summary of a regular yum update to your inbox, designed to be run by cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/usr/bin/yum update -y &> /tmp/yu | |
EMAIL=<enter your email here> | |
DOMAIN=<enter your domain here> | |
SUBJ=`cat /tmp/yu |grep "Total download size:" |cut -c 22-30` | |
if [[ $SUBJ ]] ; then | |
SUBJ="Subject: yum: $SUBJ of updates" | |
else | |
SUBJ="Subject: yum: No Updates" | |
fi | |
mv /tmp/yu /tmp/.yu | |
echo "$SUBJ" > /tmp/yu | |
echo >> /tmp/yu | |
cat /tmp/.yu >> /tmp/yu | |
rm /tmp/.yu | |
cat /tmp/yu | /usr/sbin/sendmail -F"$DOMAIN" $EMAIL | |
rm /tmp/yu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment