shellchecking
This commit is contained in:
17
bin/borg.sh
17
bin/borg.sh
@@ -2,13 +2,13 @@
|
||||
|
||||
[[ ! -f "$HOME/.borgbackup.env" ]] && printf "\$HOME/.borgbackup.env doesn't exist!\n" && exit 1
|
||||
|
||||
if [[ "$(stat -c %A $HOME/.borgbackup.env)" != "-rw-------" ]]; then
|
||||
if [[ "$(stat -c "$HOME/.borgbackup.env")" != "-rw-------" ]]; then
|
||||
printf "WARNING!!!! \$HOME/.borgbackup.env has the wrong permissions!\n"
|
||||
printf "\nrun : chmod 0600 \$HOME/.borgbackup.env\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$HOME/.borgbackup.env"
|
||||
source "${HOME}/.borgbackup.env"
|
||||
|
||||
|
||||
# some helpers and error handling:
|
||||
@@ -78,3 +78,16 @@ borg prune \
|
||||
--keep-monthly 6 \
|
||||
|
||||
prune_exit=$?
|
||||
|
||||
# use highest exit code as global exit code
|
||||
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
|
||||
|
||||
if [ ${global_exit} -eq 0 ]; then
|
||||
info "Backup and Prune finished successfully"
|
||||
elif [ ${global_exit} -eq 1 ]; then
|
||||
info "Backup and/or Prune finished with warnings"
|
||||
else
|
||||
info "Backup and/or Prune finished with errors"
|
||||
fi
|
||||
|
||||
exit ${global_exit}
|
||||
|
Reference in New Issue
Block a user