Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
agoncharov-reef committed Feb 24, 2025
1 parent 4820803 commit 4ba1bc4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eu

if [ ! -f "$1" ]; then
echo "Pass existing backup file name as the first argument"
find ${BACKUP_LOCAL_DIR} -name "*.dump.zstd" | sort -r
find "$BACKUP_LOCAL_DIR" -name "*.dump.zstd" | sort -r
exit 127
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "${SCRIPT_DIR}/common.sh"

echo "Local backups:"
find ${BACKUP_LOCAL_DIR} -name "*.dump.zstd" | sort -r
find "$BACKUP_LOCAL_DIR" -name "*.dump.zstd" | sort -r

if [ -n "${BACKUP_B2_BUCKET}" ]; then
export B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID"
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.repostory_name}}/backups/bin/restore-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "${SCRIPT_DIR}/common.sh"

if [[ $# -ne 1 ]]; then
echo "Usage: ./restore-db.sh <FILE>"
${SCRIPT_DIR}/list-backups.sh
"${SCRIPT_DIR}"/list-backups.sh
exit 2
fi

Expand All @@ -14,7 +14,7 @@ if [[ "$1" == b2://* || "$1" == b2id://* ]]; then
export B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET"
b2 cat "$1" | pg_restore -c -d "$DATABASE_URL"
else
cat "$1" | pg_restore -c -d "$DATABASE_URL"
pg_restore -c -d "$DATABASE_URL" < "$1"
fi

echo 'restore finished'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
if [ -n "${BACKUP_LOCAL_ROTATE_KEEP_LAST:-}" ]; then
echo "Rotating backup files - keeping ${BACKUP_LOCAL_ROTATE_KEEP_LAST} last ones"
files_to_delete=$(ls -1 /var/backups/*.dump.zstd | sort -r | tail -n "+${BACKUP_LOCAL_ROTATE_KEEP_LAST}")
files_to_delete=$(find /var/backups -name "*.dump.zstd" | sort -r | tail -n "+${BACKUP_LOCAL_ROTATE_KEEP_LAST}")
echo "$files_to_delete" | xargs rm
echo "Removed:"
echo "$files_to_delete"
Expand Down

0 comments on commit 4ba1bc4

Please sign in to comment.