bundles/backup-{client,server}: introduce
This commit is contained in:
parent
59c1cb8551
commit
f71653e3ce
23 changed files with 171 additions and 0 deletions
31
bundles/backup-client/files/generate-backup
Normal file
31
bundles/backup-client/files/generate-backup
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/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" \
|
||||
"${path}" "$ssh_login":backups/
|
||||
|
||||
exitcode=$?
|
||||
if (( exitcode != 0 )) && (( exitcode != 24 ))
|
||||
then
|
||||
rsync_errors+=" $ret"
|
||||
fi
|
||||
% endfor
|
||||
|
||||
if [[ -n "$rsync_errors" ]]
|
||||
then
|
||||
echo "rsync_error$rsync_errors" > "$statusfile"
|
||||
fi
|
||||
|
||||
echo "ok" > "$statusfile"
|
Loading…
Add table
Add a link
Reference in a new issue