server-debian/scripts/purge

36 lines
548 B
Plaintext
Raw Permalink Normal View History

2023-10-20 13:40:58 +02:00
#!/usr/bin/zsh
# purge memory
free -h
echo "clearing memory"
sudo sync
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
free -h
# clear logs
echo "clearing /var/log"
sudo du -hs /var/log
sudo find /var/log -type f -delete
sudo du -hs /var/log
#
rm -rf /var/lib/systemd/coredump/*
echo "clearing /etc/nginx/logs"
sudo du -hs /etc/nginx/logs
sudo find /etc/nginx/logs -type f -delete
sudo du -hs /etc/nginx/logs
rm ~/.xsession-errors*
# relete occasional junk
rm ~/rmlint.*
# empty trash
rm -rf ~/.local/share/Trash
sudo rm -rf /.Trash-1000