fix snapshot_filter for deletion

This commit is contained in:
Thorsten Spille 2023-02-18 12:13:01 +01:00
parent 7483214075
commit e7b707bc47

View File

@ -126,7 +126,7 @@ for name in "${syncvols[@]}"; do
done done
# cleanup old snapshots # cleanup old snapshots
for interval in $(echo -e $snapshot_filter) ; do for interval in $(echo -e $snapshot_filter | sed "s/|/ /g") ; do
guid=$($ssh $source "zfs list -H -o guid,name -S creation -t snapshot $name | grep $interval | cut -f1 | tail -1") guid=$($ssh $source "zfs list -H -o guid,name -S creation -t snapshot $name | grep $interval | cut -f1 | tail -1")
if [[ "$(echo -e "$guid" | sed 's/\n//g')" != "" ]]; then if [[ "$(echo -e "$guid" | sed 's/\n//g')" != "" ]]; then
for snap in $($zfs list -H -o name,guid -S creation -t snapshot $target/$name | grep $interval | grep --after-context=200 $guid | grep -v $guid | cut -f1); do for snap in $($zfs list -H -o name,guid -S creation -t snapshot $target/$name | grep $interval | grep --after-context=200 $guid | grep -v $guid | cut -f1); do