blob: d3b9cbe7e5131362036654b15a184efc9a9422c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/sh
DEST_URL=$1
SRC_POOL=$2
DEST_POOL=$3
OLD_SNAP=$(ssh root@$DEST_URL "zfs list -t snapshot -o name $DEST_POOL | tail -n1" | cut -d "@" -f2)
NEW_SNAP=$(zfs list -t snapshot -o name $SRC_POOL | tail -n1 | cut -d "@" -f2)
echo "Old snapshot: '$OLD_SNAP'"
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"
fi
|