Last active
March 28, 2026 06:15
-
-
Save mehargags/cf0723d0bf82fb58b6c29681e5080a8e to your computer and use it in GitHub Desktop.
clear-logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| journalctl --rotate | |
| journalctl --vacuum-time=1s | |
| systemctl restart systemd-journald.service | |
| find /var/log -type f \( -name "*.gz" -o -name "*.xz" -o -name "*.1" -o -name "*.[0-9]" \) -delete | |
| find /usr/local/hestia/log/ -type f -name "*.log" -exec truncate -s 0 {} + | |
| find /var/log/ -type f \( -name "*.log" -o -name "*_log" \) -exec truncate -s 0 {} + | |
| find /home/ -type f -name "*.log" ! -path "*/.cache/*" -exec truncate -s 0 {} + | |
| find /home -type f -iname '*.log' -print0 | xargs -0 truncate -c -s0 | |
| find /usr/ -type f -name "*.log" ! -path "/usr/src/*" ! -path "/usr/share/*" -exec truncate -s 0 {} + | |
| find /usr/ -type f -iname '*.log' -print0 | xargs -0 truncate -c -s0 | |
| truncate -s 0 /var/log/apache2/domains/*log | |
| truncate -s 0 /var/log/apache2/domains/*bytes | |
| truncate -s 0 /var/log/*_log | |
| # Clear kernel logs (if needed) | |
| dmesg -C | |
| # Clear temporary files (older than 7 days) | |
| find /tmp -type f -atime +7 -delete | |
| sync; echo 1 > /proc/sys/vm/drop_caches | |
| sync; echo 2 > /proc/sys/vm/drop_caches | |
| sync; echo 3 > /proc/sys/vm/drop_caches | |
| # Clean exim Queue | |
| exim -bpc | |
| exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash | |
| systemctl restart exim4 | |
| # only list FPM Names | |
| ##ls /etc/init.d/php* | grep -o 'php[0-9]\+\.[0-9]\+-fpm' | |
| journalctl --rotate | |
| journalctl --vacuum-time=1s | |
| systemctl restart systemd-journald.service | |
| # Restart services | |
| systemctl restart mariadb apache2 nginx | |
| for fpm in $(ls /etc/init.d/php* | grep -o 'php[0-9]\+\.[0-9]\+-fpm'); do systemctl restart "$fpm"; done | |
| echo -e "\n\n\nsystemctl restart mariadb apache2 nginx php{$(ls /etc/init.d/php*-fpm 2>/dev/null | grep -o 'php[0-9]\+\.[0-9]\+' | cut -c4- | paste -sd,)}-fpm" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment