Last active
August 29, 2015 14:06
-
-
Save luanlmd/c948010454779f94c593 to your computer and use it in GitHub Desktop.
Remove files if disc is almost full
This file contains 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
if [ $(df -P /dev/sda1 | awk '{ gsub("%",""); capacity = $5 }; END { print capacity }') -gt 95 ] | |
then | |
find /var/www/html/ -type f | sort -n | head -50 | xargs rm | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment