Created
December 1, 2012 20:47
-
-
Save bdha/4184970 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash -e | |
| REMOTE_POOL=tank2 | |
| LOCAL_POOL=tank | |
| TARGET_HOST=foo | |
| LAST_SYNCED=$( ssh $TARGET_HOST zfs list -t snapshot -o name -r $REMOTE_POOL/zones/icg_db/mysql | tail -1 ) | |
| echo "r: $LAST_SYNCED" | |
| LAST_SNAPSHOT=$( zfs list -t snapshot -o name -r tank/zones/icg_db/mysql | tail -1 ) | |
| echo "l: $LAST_SNAPSHOT" | |
| # In case the target/source pool names are different. | |
| RENAMED_STREAM=$( echo $LAST_SYNCED | sed -e "s/$REMOTE_POOL/$LOCAL_POOL/" ) | |
| echo "s: $RENAMED_STREAM : $LAST_SNAPSHOT -> $REMOTE_POOL" | |
| zfs send -vI $RENAMED_STREAM $LAST_SNAPSHOT | ssh $TARGET_HOST zfs recv -vdF $REMOTE_POOL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment