Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Make clean_up work on custom dirs as well
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Jun 3, 2019
1 parent 8068767 commit 27f5162
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backup.sh
Expand Up @@ -40,7 +40,7 @@ add_to_archive() {
}

clean_up() {
/usr/bin/env find "${__BACKUP_DIR}" -ctime +${__BACKUP_AGE} -delete || \
/usr/bin/env find "${1}" -ctime +${__BACKUP_AGE} -delete || \
die "Cleanup failed!"
}

Expand Down Expand Up @@ -134,4 +134,9 @@ case ${1} in
;;
esac

clean_up
echo "Cleaning up..."
# Run cleanup on every backup directory.
for i in ${__BACKUP_DIR} ${__BACKUP_DIR_CONFIGS} ${__BACKUP_DIR_DOCKER} \
${__BACKUP_DIR_POSTGRES}; do
[[ ! -z $i ]] && clean_up $i
done

0 comments on commit 27f5162

Please sign in to comment.