Skip to content

Instantly share code, notes, and snippets.

@vmiller
Last active August 29, 2015 14:03
Show Gist options
  • Save vmiller/f5bd91a683298093c182 to your computer and use it in GitHub Desktop.
Save vmiller/f5bd91a683298093c182 to your computer and use it in GitHub Desktop.
Script to run a Reposado repo sync and email an admin(s) only if there are changes.
#!/bin/bash
# Based on a script found here :
# https://groups.google.com/forum/#!topic/reposado/F8-rTWdb5ho
#
RUSER=reposado
RECIPIENTS="user@company.com"
PATH="/usr/share/reposado"
/usr/bin/python /usr/share/reposado/code/repo_sync --log /var/log/reposync.log
/usr/bin/python /usr/share/reposado/code/repoutil --updates | /bin/cut -d[ -f1 > ./newupdate.txt
if ! /usr/bin/diff ./newupdate.txt ./previousupdate.txt > ./availableupdates.txt ; then
for ADDR in $RECIPIENTS; do /bin/mail -s "New Apple Updates Downloaded" $ADDR < availableupdates.txt
done
fi
/bin/rm -f previousupdate.txt
/bin/mv newupdate.txt previousupdate.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment