From 42600fff64e857832abd8455aff5057e9dc54223 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Mon, 10 Aug 2020 14:24:19 +0200 Subject: [PATCH] added the trap and info function --- salt/states/files/borg.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/salt/states/files/borg.sh b/salt/states/files/borg.sh index d6d6962..4bb7539 100755 --- a/salt/states/files/borg.sh +++ b/salt/states/files/borg.sh @@ -10,6 +10,12 @@ fi source "$HOME/.borgbackup.env" + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + + info "Starting backup" # Backup the most important directories into an archive named after