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