Print steps if verbose and show the exit codes on error

This commit is contained in:
Paul van Tilburg 2016-08-21 21:46:32 +02:00
parent 53d933b715
commit 896121ef91
1 changed files with 8 additions and 5 deletions

View File

@ -37,17 +37,20 @@ if [ -z "$RESTIC_PASSWORD" ]; then
fi
# Create a new backup
restic $RESTIC_QUIET backup $HOME $RESTIC_BACKUP_OPTIONS
if [ $? -ne 0 ]; then
test -z "$RESTIC_QUIET" && echo "I: Backup step…"
restic $RESTIC_QUIET backup $RESTIC_DIR $RESTIC_BACKUP_OPTIONS
status=$?
if [ $status -ne 0 ]; then
notify "Unable to finish the backup!"
exit 2
fi
# Verify the backup
test -z "$RESTIC_QUIET" && echo "I: Check step…"
restic $RESTIC_QUIET check
if [ $? -ne 0 ]; then
status=$?
if [ $status -ne 0 ]; then
echo "E: Exit code was $status"
notify "Repository check of the backup failed!"
exit 3
fi