Created
December 1, 2019 22:09
-
-
Save segrax/b56788db7a9feddd795915dd45d41093 to your computer and use it in GitHub Desktop.
Check a remote server for a zfs send resume token, and resume transfer if found
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# ZFS Archive Resume Script | |
# Robert Crossfield | |
# | |
# Check for a zfs send resume token, and resume the transfer if found | |
# 26-05-2019 | |
# | |
HOST=me@mydomain.com | |
PORT=12345 | |
MOUNT=MyZpool/Mount | |
TOKEN=`ssh -q $HOST -p $PORT zfs get all $MOUNT | awk '{for (I=1;I<=NF;I++) if ($I == "receive_resume_token") {print $(I+1)};}'` | |
if [ ! "$TOKEN" ];then | |
echo "No token found" | |
exit | |
else | |
zfs send -t $TOKEN | pv | ssh $HOST -p $PORT zfs recv -F -s $MOUNT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment