7000 snapvault

#!/usr/bin/bash

#variables
source=pool_0/local/base/source
dest=pool_0/local/base/source
node2="192.168.108.61 confirm shell "
schedule=60

#functions
function baseline {
zfs snapshot ${source}@currentfs
zfs send ${source}@currentfs|ssh ${node2} zfs receive ${dest}@currentfs
echo "baseline created"
}

function dryrun {
run=0
ret=5
echo dry
while (($run <= $ret)) do ssh ${node2} zfs snapshot ${dest}@back.${run} ((run+=1)) echo $run done } function vault { run=0 ret=5 old=5 echo vault started zfs rename ${source}@currentfs ${source}@back.0 zfs snapshot ${source}@currentfs #rename older shapshots ssh ${node2} zfs destroy ${dest}@back.${ret} while (($run < $ret)) do ((run+=1)) ((younger=${ret}-${run})) ssh ${node2} zfs rename ${dest}@back.${younger} ${dest}@back.${old} ((old=${old}-1)) done ssh ${node2} zfs rename ${dest}@currentfs ${dest}@back.0 #do the vault zfs send -i ${source}@back.0 ${source}@currentfs | ssh ${node2} zfs receive ${dest}@currentfs zfs destroy ${source}@back.0 echo "vault done" } #main baseline dryrun while true do vault sleep $schedule done

This entry was posted in solaris. Bookmark the permalink.

Comments are closed.