Skip to content

Instantly share code, notes, and snippets.

@thikade
Created November 20, 2015 16:09
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 thikade/62b63bc25bf6cd61b5cb to your computer and use it in GitHub Desktop.
Save thikade/62b63bc25bf6cd61b5cb to your computer and use it in GitHub Desktop.
SLES12 Auto-Update Downloader
xswp0001:~/bin # cat sles-updates
#!/bin/sh
MAIL_TO="me@mine.com"
ZYP=/usr/bin/zypper
HOSTNAME="(`hostname`)"
if [ "$1" != "mail" ]; then
$ZYP ref &> /dev/null
$ZYP --non-interactive patch --download-only &> /dev/null
$ZYP --non-interactive update --download-only &> /dev/null
fi
T=`mktemp -p /root`
$ZYP patch-check > $T
if [ $? -eq 101 ]; then
# only send email if security patches available!
$ZYP lp >> $T
cat $T | /usr/bin/mail -s "SLES Security-Updates auf \"$HOSTNAME\" verfuegbar" $MAIL_TO
fi
rm -f $T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment