Last active
December 26, 2015 20:29
-
-
Save ngfw/7209299 to your computer and use it in GitHub Desktop.
Clear cache files with cron
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
#!/bin/bash | |
# Params | |
# Remove Files Every N Min | |
MINUTESTOKEEPFILES=2880 | |
# DO NOT EDIT BELOW THIS LINE | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" | |
done | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
# Find And Remove Files | |
nice -n 39 find $DIR -type f -name "*.cache" -mmin +$MINUTESTOKEEPFILES -delete | |
nice -n 39 find $DIR -type f -name "CURLCOOKIE*" -mmin +$MINUTESTOKEEPFILES -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment