Skip to content

Commit

Permalink
Disable no-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonbaeten committed Apr 26, 2024
1 parent 873365a commit 33b4ae4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ The account id of the account that has write access to the backblaze repository.
The secret account key of the account that has write access to the backblaze
repository.

### TGBS_BACKUP_LOCK
If this is set to `1`, the `--no-lock` flag will not be set.

### TGBS_BACKUP_TAGS
If this is set, then the backup is tagged with the value of this environment
variable. Different tags can be comma-separated. If the variable is not set,
Expand Down
10 changes: 1 addition & 9 deletions bin/docker-file-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,12 @@ if [ ! -z "$TGBS_BACKUP_PATH" ]; then
done
fi

TGBS_BACKUP_LOCKFILE=true
if [ -z "$TGBS_BACKUP_LOCK" ] || [ "$TGBS_BACKUP_LOCK" == "0" ] || [ "$TGBS_BACKUP_LOCK" == "false" ]; then
backup_cmd+=( "--no-lock" )
TGBS_BACKUP_LOCKFILE=false
fi

backup_cmd+=( "$TGBS_BACKUP_PATH" )

if [ "${#TGBS_BACKUP_TAGS_CLEAN[@]}" -gt 0 ]; then
IFS=',' echoerr "--- Using tags for restic snapshot: ${TGBS_BACKUP_TAGS_CLEAN[*]}"
fi
if [ "${TGBS_BACKUP_LOCKFILE}" = false ]; then
echoerr "--- WARNING: Not using a lockfile"
fi

echoerr "--- Creating restic snapshot from $TGBS_BACKUP_PATH to repository $RESTIC_REPOSITORY"

# Run the restic command
Expand Down
11 changes: 1 addition & 10 deletions bin/docker-psql-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,13 @@ if [ -n "$TGBS_PSQL_BACKUP" ] && [ "$TGBS_PSQL_BACKUP" != "0" ] && [ "$TGBS_PSQL
done
fi

# Add option for the --no-lock command line flag for restic added by tg
TGBS_PSQL_BACKUP_LOCKFILE=true
if [ -z "$TGBS_BACKUP_LOCK" ] || [ "$TGBS_BACKUP_LOCK" == "0" ] || [ "$TGBS_BACKUP_LOCK" == "false" ]; then
backup_cmd+=( "--no-lock" )
TGBS_PSQL_BACKUP_LOCKFILE=false
fi

# Backup all previously created psql files
backup_cmd+=( "${TGBS_PSQL_BACKUP_FILENAMES[@]}" )

if [ "${#TGBS_PSQL_BACKUP_TAGS_CLEAN[@]}" -gt 0 ]; then
IFS=',' echoerr "--- Using tags for restic snapshot: ${TGBS_PSQL_BACKUP_TAGS_CLEAN[*]}"
fi
if [ "${TGBS_PSQL_BACKUP_LOCKFILE}" = false ]; then
echoerr "--- WARNING: Not using a lockfile"
fi

echoerr "--- Creating restic snapshot from PostgreSQL backup to repository $RESTIC_REPOSITORY"

# Run the restic command
Expand Down

0 comments on commit 33b4ae4

Please sign in to comment.