backup all doesnt stop on first error

This commit is contained in:
CroneKorkN 2025-01-09 23:41:21 +01:00
parent 16313b9e40
commit e117acac04
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw
2 changed files with 20 additions and 2 deletions

View file

@ -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

View file

@ -1,6 +1,6 @@
#!/bin/bash
set -exu
set -eu
path=$1
uuid=$(jq -r .client_uuid < /etc/backup/config.json)