Only keep one snapshot if .btrfish-keepone exists in the root of the subvolume
This commit is contained in:
parent
79bae2d827
commit
f8fd363aad
10
backup.fish
10
backup.fish
|
@ -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!"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue