Skip to content

Instantly share code, notes, and snippets.

@CroneKorkN
Last active August 16, 2017 19:37
Show Gist options
  • Save CroneKorkN/7c2bf6298414143f3877bdd8ecbcdeeb to your computer and use it in GitHub Desktop.
Save CroneKorkN/7c2bf6298414143f3877bdd8ecbcdeeb to your computer and use it in GitHub Desktop.
#!/bin/bash
host="root@example"
date="$(date +%Y-%m-%d_%H-%M)"
for d in $(zfs list -o mountpoint); do
if [ $d = "MOUNTPOINT" ]; then continue; fi # skip table head
from="$from $d"
done
while true; do
rsync -avz --progress --relative $from $host:/backup
if [ $? == 0 ]; then break; fi
echo $(date +%Y-%m-%d_%H-%M) retrying >> backup_log
sleep 10
done
ssh $host \""zfs snapshot backup@$date"\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment