Skip to content

Instantly share code, notes, and snippets.

@stampycode
Last active June 15, 2016 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stampycode/264e0349a031309072d593ff2ed228ab to your computer and use it in GitHub Desktop.
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
#!/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