fix lots of backup stuff
This commit is contained in:
parent
3ce2807d9f
commit
b6fa63ad42
3 changed files with 17 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -exu
|
||||||
|
|
||||||
# FIXME: inelegant
|
# FIXME: inelegant
|
||||||
% if wol_command:
|
% if wol_command:
|
||||||
${wol_command}
|
${wol_command}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue