Explorar o código

Extended cleaning

pmacko hai 1 mes
pai
achega
dc215b9fab
Modificáronse 1 ficheiros con 24 adicións e 23 borrados
  1. 24 23
      clean.sh

+ 24 - 23
clean.sh

@@ -1,24 +1,25 @@
-#!/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"
+#!/bin/bash
+#########################################################################
+#                         Script for cleaning logs                      #
+#                             Created by DoIT                           #
+#                                 ver 0.6                               #
+#########################################################################
+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 /root/.bash_history
+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
+test -d /var/lib/clamav && rm -rf /var/lib/clamav/tmp*
+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'