Skip to content

Instantly share code, notes, and snippets.

@jsonzilla
Last active March 4, 2024 19:23
Show Gist options
  • Save jsonzilla/106e10f24c4e6daf52a49684e10546f8 to your computer and use it in GitHub Desktop.
Save jsonzilla/106e10f24c4e6daf52a49684e10546f8 to your computer and use it in GitHub Desktop.
Crashfix Cleanup Routine

Crashfix Cleanup Routine

Check the disk size

$ df -h
...
/dev/nvme0n1p1   500G  404G   76G  85% /
...

Clean monitor log

cd /var/log/crashfix
sudo du -hc --max-depth=0 .
sudo rm monitor.log
sudo du -hc --max-depth=0 .

Clean crash reports older than 120 days

cd /var/www/html/protected/data/crashReports/
sudo du -hc --max-depth=0 .
sudo find . -type f -ctime +120 -delete
sudo du -hc --max-depth=0 .

Check the disk size

$ df -h
...
/dev/nvme0n1p1   500G  404G   76G  85% /
...

Add to cron

Create a file in /scripts/lean_crashfix_120_days.sh with the content below:

find /var/www/html/protected/data/crashReports/ -type f -ctime +120 -delete

Open cron table to edition

$ sudo crontab -e -u root

Add a new line

0 5 * * 1 /scripts/clean_crashfix_120_days.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment