Created
March 31, 2014 09:49
-
-
Save 24HOURSMEDIA/9888936 to your computer and use it in GitHub Desktop.
delete backuop files older than 90 days
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
#!/bin/sh | |
# | |
# Delete backup more than 90 days old. | |
# | |
backupDir="/var/lib/psa/dumps/tmp" | |
# | |
daysToKeep=90 | |
echo "Checking for files older than $daysToKeep days in $backupDir" | |
listOfFiles=`find $backupDir -mtime +$daysToKeep` | |
if [ ! -z $listOfFiles ] | |
then | |
echo "Found [$listOfFiles]" | |
else | |
echo "None found." | |
fi | |
for toDelete in $listOfFiles | |
do | |
echo "Deleting $toDelete" | |
rm -rf $toDelete | |
done | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment