kleine anpassungen
This commit is contained in:
		
							parent
							
								
									57cc8401e7
								
							
						
					
					
						commit
						d05a6fe576
					
				@ -14,8 +14,10 @@
 | 
			
		||||
mkdir -p /var/log/script-logs
 | 
			
		||||
 | 
			
		||||
# Variablen
 | 
			
		||||
SCRIPT_NAME=weekly-update.v2.sh
 | 
			
		||||
HOSTNAME=$(hostname)
 | 
			
		||||
MAIL=root
 | 
			
		||||
LOGDIR=/var/log/script-logs
 | 
			
		||||
 | 
			
		||||
# Aktualisiere das System und speichere die Ausgabe in eine Log-Datei
 | 
			
		||||
sudo apt update && sudo apt upgrade -y &> /var/log/script-logs/weekly-update.v2.log
 | 
			
		||||
@ -23,7 +25,7 @@ sudo apt update && sudo apt upgrade -y &> /var/log/script-logs/weekly-update.v2.
 | 
			
		||||
    # Überpruefe, ob das Update erfolgreich war
 | 
			
		||||
    if [ $? -ne 0 ]; then
 | 
			
		||||
        # Sende eine E-Mail, wenn das Update fehlgeschlagen ist
 | 
			
		||||
        log_contents=$(cat /var/log/internal-scripts/weekly-update.2.0.log)
 | 
			
		||||
        log_contents=$(cat $LOGDIR/$SCRIPT_NAME.log)
 | 
			
		||||
        echo -e "Das Update auf $HOSTNAME ist fehlgeschlagen! \n\nLog-Inhalt: \n\n$log_contents" | mail -s "Woechentliches Update auf $hostname fehlgeschlagen" $MAIL
 | 
			
		||||
    else
 | 
			
		||||
        # Raeume das System auf
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user