diff options
-rwxr-xr-x | do_backup.sh | 8 | ||||
-rwxr-xr-x | do_replicate.sh | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/do_backup.sh b/do_backup.sh new file mode 100755 index 0000000..35aefc9 --- /dev/null +++ b/do_backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no -o ConnectTimeout=5 $1 'exit 0' +if [ $? == 0 ];then + echo "Online check succeeded." +else + echo "Backup target is offline." +fi diff --git a/do_replicate.sh b/do_replicate.sh index d3b9cbe..19560dc 100755 --- a/do_replicate.sh +++ b/do_replicate.sh @@ -1,5 +1,9 @@ #!/bin/sh +# Assumes we already have an initial backup (with just -R) +# Ignores sub-datasets that don't have a snapshot (make sure +# this is what you want) + DEST_URL=$1 SRC_POOL=$2 DEST_POOL=$3 @@ -13,5 +17,6 @@ echo "New snapshot: '$NEW_SNAP'" if [ "$OLD_SNAP" = "$NEW_SNAP" ]; then echo "Up to date, nothing to do..." else - zfs send -Rw -I "$SRC_POOL"@"$OLD_SNAP" "$SRC_POOL"@"$NEW_SNAP" -s | pv | ssh root@DEST_URL "zfs recv -Fvdu $DEST_POOL" + zfs send -Rw -I "$SRC_POOL"@"$OLD_SNAP" "$SRC_POOL"@"$NEW_SNAP" -s | pv | ssh root@$DEST_URL "zfs recv -Fvdu $DEST_POOL" + echo "Finished backing up: '$OLD_SNAP' to '$NEW_SNAP'" fi |