Only keep one snapshot if .btrfish-keepone exists in the root of the subvolume

This commit is contained in:
Les De Ridder 2016-06-08 16:38:21 +00:00
parent 79bae2d827
commit f8fd363aad
2 changed files with 12 additions and 2 deletions

View File

@ -51,11 +51,17 @@ end
echo "Renaming subvolumes on target..."
for pair in $pairs
set subvol (clean-name (get-subvol $pair))
set mount (get-mount $pair)
if not test -f $mount/.btrfish-keepone
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
else
delete-target-subvolume $subvol
end
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
rename-target-subvolume $subvol-new $subvol
sudo rm (get-mount $pair)/.btrfish-lock
sudo rm $mount/.btrfish-lock
end
echo "Done!"

View File

@ -12,6 +12,10 @@ function rename-target-subvolume
ssh -i $sshkey $targetuser@$targethost mv -v $targetpath/$argv[1] $targetpath/$argv[2]
end
function delete-target-subvolume
ssh -i $sshkey $targetuser@$targethost sudo btrfs subvolume delete $targetpath/$argv[1]
end
function get-subvol
echo $argv | cut -d' ' -f1
end