#!/bin/bash nice -n 19 ionice -c 3 find /home/*/tmp/ -type f -delete find /home/ -name '.wp-cli' -type d -exec rm -rf {} \; rm /var/backups/* rm /var/cache/apt/archives/* cd /var/log truncate -s 0 xferlog lastlog faillog btmp syslog; find /var/log/ -name "*.log" -not -path "/var/log/apt/*" -type f -exec truncate -s 0 {} \; find /var/log/ -name "*.err" -type f -exec truncate -s 0 {} \; find /var/log/ -name "errors" -type f -exec truncate -s 0 {} \; find /var/log/ -name "*.info" -type f -exec truncate -s 0 {} \; find /var/log/ -name "*.warn" -type f -exec truncate -s 0 {} \; find /var/log/ -type f -name "*.1" -delete find /var/log/ -type f -name "*.2" -delete find /var/log/ -type f -name "*.3" -delete find /var/log/ -type f -name "*.4" -delete find /var/log/ -type f -name "*.5" -delete find /var/log/ -type f -name "*.6" -delete find /var/log/ -type f -name "*.7" -delete find /var/log/ -name "*.gz" -type f -delete find /usr/local/vesta/log/ -type f -name "*.log" -exec truncate -s 0 {} \; find /usr/local/vesta/log/ -type f -not -name "*.log" -delete find /var/log/exim4/ -type f -exec truncate -s 0 {} \; find /home/*/web/*/public_html/wp-content/aiowps_backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete find /home/*/web/*/public_html/wp-content/envato-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete find /home/*/web/*/public_html/wp-content/ai1wm-backups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete find /home/*/web/*/public_html/wp-content/wpvividbackups/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete find /home/*/web/*/public_html/wp-content/updraft/ -type f -not -name ".htaccess" -not -name "index.php" -not -name "index.html" -not -name "web.config" -delete find /home/*/web/*/public_html/ -type f -name "*.wpress" -delete find /home/*/web/*/public_html/ -type f -name "error_log" -exec truncate -s 0 {} \; find /home/*/web/*/public_html/ -type f -name "error_log.txt" -exec truncate -s 0 {} \; find /home/ -type f -name "*.log" -exec truncate -s 0 {} \; fail2ban_running=$(/usr/local/vesta/bin/v-list-sys-services | grep 'fail2ban' | grep -c 'running') if [ $fail2ban_running -eq 1 ]; then systemctl stop fail2ban fi if [ -f "/var/lib/fail2ban/fail2ban.sqlite3" ]; then rm /var/lib/fail2ban/fail2ban.sqlite3 fi if [ $fail2ban_running -eq 1 ]; then systemctl start fail2ban fi echo "=== Garbage cleaned ==="