diff --git a/bundles/backup/files/backup_all b/bundles/backup/files/backup_all index 14b9fd9..7c65f49 100644 --- a/bundles/backup/files/backup_all +++ b/bundles/backup/files/backup_all @@ -1,13 +1,31 @@ #!/bin/bash -set -exu +set -u # FIXME: inelegant % if wol_command: ${wol_command} % endif +exit=0 +failed_paths="" + for path in $(jq -r '.paths | .[]' < /etc/backup/config.json) do + echo backing up $path /opt/backup/backup_path "$path" + # set exit to 1 if any backup fails + if [ $? -ne 0 ] + then + echo ERROR: backing up $path failed >&2 + exit=5 + failed_paths="$failed_paths $path" + fi done + +if [ $exit -ne 0 ] +then + echo "ERROR: failed to backup paths: $failed_paths" >&2 +fi + +exit $exit diff --git a/bundles/backup/files/backup_path_via_zfs b/bundles/backup/files/backup_path_via_zfs index 66797d3..fddb71d 100644 --- a/bundles/backup/files/backup_path_via_zfs +++ b/bundles/backup/files/backup_path_via_zfs @@ -1,6 +1,6 @@ #!/bin/bash -set -exu +set -eu path=$1 uuid=$(jq -r .client_uuid < /etc/backup/config.json)