Print steps if verbose and show the exit codes on error
This commit is contained in:
parent
53d933b715
commit
896121ef91
13
restic-cron
13
restic-cron
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue