Init
This commit is contained in:
commit
6a8b9708fd
9 changed files with 320 additions and 0 deletions
20
system/adjustJournalSize.sh
Normal file
20
system/adjustJournalSize.sh
Normal 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
29
system/cleanupLogs.sh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue