Delete also generated scripts and database dumps for all databses older than given number of days.

This commit is contained in:
Christoph 2017-09-02 08:54:33 +02:00
parent 1e2a1066c0
commit cf42a594e2

View File

@ -41,7 +41,7 @@ fi
PSQL_BIN_DIR_DST=$PSQL_BIN_DIR_SRC PSQL_BIN_DIR_DST=$PSQL_BIN_DIR_SRC
days=30 days=5
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
@ -575,11 +575,20 @@ fi
# #
if $_logging ; then if $_logging ; then
echo -e "\tDelete all archives in $BACKUP_BASE_DIR older than ${days} days.." echo -e "\tDelete all generated archives in $BACKUP_BASE_DIR older than ${days} days.."
fi fi
/usr/bin/find $BACKUP_BASE_DIR -type f -name "*.tar.gz" -mtime +${days} -exec /bin/rm {} \; /usr/bin/find $BACKUP_BASE_DIR -type f -name "*.tar.gz" -mtime +${days} -exec /bin/rm {} \;
if $_logging ; then
echo -e "\tDelete generated dumps for all databases older than ${days} days.."
fi
/usr/bin/find $BACKUP_BASE_DIR -type f -name "*.sql" -mtime +${days} -exec /bin/rm {} \;
if $_logging ; then
echo -e "\tDelete generated scripts for all databases older than ${days} days.."
fi
/usr/bin/find $BACKUP_BASE_DIR -type f -name "*.sh" -mtime +${days} -exec /bin/rm {} \;
if $_logging ; then if $_logging ; then
echo "" echo ""
fi fi