Skip to content

Commit 5ace2f2

Browse files
authored
Get any backups that were created off the box even if we have a failure (#442)
1 parent 0197358 commit 5ace2f2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

share/github-backup-utils/ghe-backup-mssql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,12 @@ if [ -n "$backup_type" ]; then
335335
elif [ "$backup_type" = "transaction" ]; then
336336
backup_command='ghe-export-mssql -t'
337337
fi
338-
338+
339+
backup_failed=
340+
339341
bm_start "$(basename "$0")"
340-
ghe_ssh_mssql -- "$backup_command"
342+
# record if generating the backup failed, this will allow us to collect any backups that may have been produced, even if they are not complete they are better than nothing
343+
ghe_ssh_mssql -- "$backup_command" || backup_failed='true'
341344
bm_end "$(basename "$0")"
342345

343346
# Configure the backup cadence on the appliance, which is used for diagnostics
@@ -352,4 +355,9 @@ if [ -n "$backup_type" ]; then
352355
ghe_verbose "Transferring to backup host $b"
353356
ghe_ssh_mssql "sudo cat $appliance_dir/$b" > "$backup_dir"/"$b"
354357
done
358+
359+
if [ -n "$backup_failed" ]; then
360+
log_error 'ghe-export-mssql failed to backup at least one mssql database' 1>&2
361+
exit 1
362+
fi
355363
fi

0 commit comments

Comments
 (0)