Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ backup(){
}

cleanup(){
if [ "$(find "$TARGET_DIR" -name '*.sql.*' | wc -l)" -lt "$KEEP" ]; then
return 0
fi
rm "$(find $TARGET_DIR -name '*.sql.*' | sort | head -n 1)"
cleanup
# Loop to check and remove backups if there are more than the KEEP value
while [ "$(find "$TARGET_DIR" -name "$DB_NAME-*.sql.gz" | wc -l)" -gt "$KEEP" ]; do
# Remove the oldest backup if more than KEEP backups exist
rm "$(find "$TARGET_DIR" -name "$DB_NAME-*.sql.gz" | sort | head -n 1)"
done
}

backup
Expand Down