Bläddra i källkod

Script for clean history, logs, journal and packages

pmacko 1 månad sedan
förälder
incheckning
9de91f12ca
1 ändrade filer med 24 tillägg och 0 borttagningar
  1. 24 0
      clean.sh

+ 24 - 0
clean.sh

@@ -0,0 +1,24 @@
+#!/bin/bash
+#########################################################################
+#                         Script for cleaning logs                      #
+#                            Created by PM-DoIT                         #
+#                                 ver 0.5                               #
+#########################################################################
+clear
+echo -e "- [\e[1;33mCleaning\e[0m] logs and history"
+HIS=$(find /home/ -name .bash_history)
+for h in $HIS; do rm -rf $h; done
+rm -rf /opt/log2ram*
+find /var/log/ -name "*.gz" -type f -delete
+find /var/log/ -name "*.log.*" -type f -delete
+find /var/log/ -name "*.[0-9]*" -type f -delete
+history -c
+echo -e "- [\e[1;33mCleaning\e[0m] APT archives"
+apt autoclean > /dev/null 2>&1
+apt clean > /dev/null 2>&1
+apt autoremove -y > /dev/null 2>&1
+pip cache purge > /dev/null 2>&1
+echo -e "- [\e[1;33mCleaning\e[0m] Journal"
+journalctl --vacuum-size=100M > /dev/null 2>&1
+echo -e "- [\e[1;32mActual size\e[0m] of partition"
+df -h | grep -v tmpfs | sed 's/ on//g'