From 624298e2547ffd9828a9b4688b30ba4ae13d9af7 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 14 Oct 2021 07:42:48 -0400 Subject: [PATCH] error handling for kaya-client (With a rebase by Andrew. Don't print the password) --- kaya-client | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kaya-client b/kaya-client index 7622d84..c12ebc3 100755 --- a/kaya-client +++ b/kaya-client @@ -32,4 +32,14 @@ shift 2 username="${hostname}" backupdir="${hostname}" -RESTIC_REPOSITORY="rest:http://${username}:${password}@localhost:${port}/${backupdir}/" RESTIC_PASSWORD="${password}" restic backup "$@" +export RESTIC_REPOSITORY="rest:http://${username}:${password}@localhost:${port}/${backupdir}/" +export RESTIC_PASSWORD="${password}" + +cmd=( restic backup "$@") +ret=0 +"${cmd[@]}" || ret=$? + +if (( ret )); then + echo "kaya-client: command exit code $ret: ${cmd[*]}" + exit $ret +fi -- 2.25.1