Created
          November 20, 2015 16:09 
        
      - 
      
- 
        Save thikade/62b63bc25bf6cd61b5cb to your computer and use it in GitHub Desktop. 
    SLES12 Auto-Update Downloader
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | xswp0001:~/bin # cat sles-updates | |
| #!/bin/sh | |
| MAIL_TO="[email protected]" | |
| 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