fix lots of backup stuff

This commit is contained in:
cronekorkn 2022-12-21 14:26:16 +01:00
parent 3ce2807d9f
commit b6fa63ad42
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw
3 changed files with 17 additions and 3 deletions

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -exu
# FIXME: inelegant # FIXME: inelegant
% if wol_command: % if wol_command:
${wol_command} ${wol_command}

View file

@ -1,11 +1,13 @@
#!/bin/bash #!/bin/bash
set -exu
path=$1 path=$1
if zfs list -H -o mountpoint | grep -q "$path" if zfs list -H -o mountpoint | grep -q "^$path$"
then then
/opt/backup/backup_path_via_zfs "$path" /opt/backup/backup_path_via_zfs "$path"
elif test -d "$path" elif test -e "$path"
then then
/opt/backup/backup_path_via_rsync "$path" /opt/backup/backup_path_via_rsync "$path"
else else

View file

@ -7,4 +7,14 @@ uuid=$(jq -r .client_uuid < /etc/backup/config.json)
server=$(jq -r .server_hostname < /etc/backup/config.json) server=$(jq -r .server_hostname < /etc/backup/config.json)
ssh="ssh -o ConnectTimeout=5 backup-receiver@$server" ssh="ssh -o ConnectTimeout=5 backup-receiver@$server"
rsync -av --rsync-path="sudo rsync" "$path/" "backup-receiver@$server:/mnt/backups/$uuid$path/" if test -d "$path"
then
postfix="/"
elif test -f "$path"
then
postfix=""
else
exit 1
fi
rsync -av --rsync-path="sudo rsync" "$path$postfix" "backup-receiver@$server:/mnt/backups/$uuid$path$postfix"