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 fi
# Create a new backup # Create a new backup
restic $RESTIC_QUIET backup $HOME $RESTIC_BACKUP_OPTIONS test -z "$RESTIC_QUIET" && echo "I: Backup step…"
restic $RESTIC_QUIET backup $RESTIC_DIR $RESTIC_BACKUP_OPTIONS
if [ $? -ne 0 ]; then status=$?
if [ $status -ne 0 ]; then
notify "Unable to finish the backup!" notify "Unable to finish the backup!"
exit 2 exit 2
fi fi
# Verify the backup # Verify the backup
test -z "$RESTIC_QUIET" && echo "I: Check step…"
restic $RESTIC_QUIET check restic $RESTIC_QUIET check
status=$?
if [ $? -ne 0 ]; then if [ $status -ne 0 ]; then
echo "E: Exit code was $status"
notify "Repository check of the backup failed!" notify "Repository check of the backup failed!"
exit 3 exit 3
fi fi