Franziska Kunsmann
ff607777ce
All checks were successful
bundlewrap/pipeline/head This commit looks good
31 lines
684 B
Bash
31 lines
684 B
Bash
#!/bin/bash
|
|
|
|
statusfile=/var/tmp/backup.monitoring
|
|
ssh_login="${username}@${server}"
|
|
|
|
if ! [[ -f /etc/backup.priv ]]
|
|
then
|
|
echo "abort_no_key" > "$statusfile"
|
|
exit 1
|
|
fi
|
|
|
|
rsync_errors=""
|
|
% for path in sorted(paths):
|
|
rsync -zaAP --numeric-ids --delete --relative \
|
|
--rsync-path="/usr/bin/rsync --fake-super" \
|
|
-e "ssh -o IdentityFile=/etc/backup.priv -o StrictHostKeyChecking=accept-new -p ${port}" \
|
|
"${path}" "$ssh_login":backups/
|
|
|
|
exitcode=$?
|
|
if [[ $exitcode != 0 ]] && [[ $exitcode != 24 ]]
|
|
then
|
|
rsync_errors+=" $exitcode"
|
|
fi
|
|
% endfor
|
|
|
|
if [[ -n "$rsync_errors" ]]
|
|
then
|
|
echo "rsync_error$rsync_errors" > "$statusfile"
|
|
else
|
|
echo "ok" > "$statusfile"
|
|
fi
|