This commit is contained in:
Sebastian Hanz 2025-02-17 17:56:00 +01:00
commit 6a8b9708fd
9 changed files with 320 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#!/bin/bash
# Pfad zur Datei
FILE="/etc/systemd/journald.conf"
# Überprüfen, ob die Datei existiert
if [[ ! -f $FILE ]]; then
echo "Datei $FILE existiert nicht."
exit 1
fi
# Ersetzen der betroffenen Zeilen in der Datei
sed -i \
-e 's/^#SystemMaxUse=.*$/SystemMaxUse=50M/' \
-e 's/^SystemMaxUse=.*$/SystemMaxUse=50M/' \
"$FILE"
# Datei neu laden
systemctl restart systemd-journald
echo "Die Änderungen wurden vorgenommen und systemd-journald wurde neu gestartet."

29
system/cleanupLogs.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/bash
YELLOW="\[\033[1;33m\]" # Yellow
RED="\[\033[1;31m\]" # Red
ENDCOLOR="\033[0m"
if [ $USER != root ]; then
echo -e $RED"Error: Du musst root sein"
echo -e $YELLOW"Exiting..."$ENDCOLOR
exit 0
fi
echo -e $YELLOW"Leere apt cache..."$ENDCOLOR
apt-get clean
echo -e $YELLOW"Entferne alle nicht mehr verwendete Pakete..."$ENDCOLOR
apt-get autoremove
if [ "$1" = "-l" ]; then
echo -e $YELLOW"Entferne alte Logdateien..."$ENDCOLOR
rm /var/log/*.gz >/dev/null 2>&1
rm /var/log/*.log.* >/dev/null 2>&1
rm /var/log/*.1 >/dev/null 2>&1
else
echo -e $YELLOW"Finish!"$ENDCOLOR
exit
fi
echo -e $YELLOW"Finish!"$ENDCOLOR
exit