aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-26 09:35:56 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-26 09:35:56 -0300
commit2add786e4cc6765b63f43e2bc3407e0b619490e0 (patch)
treeabd2aef541981b18227e6f78d6a3325d13028a57
parent3786bb0fe049ce8866141cce3852154d2cbc6536 (diff)
downloadborger-2add786e4cc6765b63f43e2bc3407e0b619490e0.tar.gz
borger-2add786e4cc6765b63f43e2bc3407e0b619490e0.tar.bz2
Check exit status globally
-rwxr-xr-xborger30
1 files changed, 23 insertions, 7 deletions
diff --git a/borger b/borger
index 705c539..5b002b9 100755
--- a/borger
+++ b/borger
@@ -127,9 +127,9 @@ function borger_create {
backup_exit=$?
- if [ "$backup_exit" != "0" ]; then
- fatal "Error creating snapshot"
- fi
+ #if [ "$backup_exit" != "0" ]; then
+ # fatal "Error creating snapshot"
+ #fi
}
# Use the `prune` subcommand to maintain daily, weekly and monthly archives.
@@ -145,11 +145,11 @@ function borger_prune {
--keep-weekly $KEEPWEEKLY \
--keep-monthly $KEEPMONTHLY \
- prune_exit=$?
+ prune_exit=$?
- if [ "$prune_exit" != "0" ]; then
- fatal "Error pruning repository"
- fi
+ #if [ "$prune_exit" != "0" ]; then
+ # fatal "Error pruning repository"
+ #fi
}
# Main backup procedure
@@ -159,6 +159,22 @@ function borger_run {
borger_init
borger_create
borger_prune
+ borger_exit
+}
+
+function borger_exit {
+ # Use highest exit code as global exit code
+ global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
+
+ if [ ${global_exit} -eq 1 ]; then
+ info "Backup and/or Prune finished with a warning"
+ fi
+
+ if [ ${global_exit} -gt 1 ]; then
+ info "Backup and/or Prune finished with an error"
+ fi
+
+ exit ${global_exit}
}
# Ensure we have our base config folder