]> code.delx.au - monosys/commitdiff
lib-ext-backup: move snapshot cleanup code into the correct function
authorJames Bunton <jamesbunton@delx.net.au>
Tue, 5 May 2020 12:18:09 +0000 (22:18 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Tue, 5 May 2020 12:18:09 +0000 (22:18 +1000)
lib-ext-backup

index 35aca43a47b3755faaa9180d2d05e395a22c4e97..8d3bbba2b07282da6dc8de016b68fe4a2a4fc6c1 100644 (file)
@@ -61,16 +61,16 @@ function pool_setup {
 function syncoidw {
     echo "> syncoid $1"
     syncoid "$@" --identifier "$ZPOOLNAME"
-
-    zfs list -t snapshot -H -o name -r "$ZPOOLNAME" \
-        | grep -F @syncoid_ \
-        | grep -Fv "@syncoid_$ZPOOLNAME" \
-        | xargs -rn1 zfs destroy -v
 }
 
 function snapshot_cleanup {
     echo "> Cleaning snapshots"
     sanoid --configdir=/etc/sanoid/ext-backup --verbose --prune-snapshots
+
+    zfs list -t snapshot -H -o name -r "$ZPOOLNAME" \
+        | grep -F @syncoid_ \
+        | grep -Fv "@syncoid_$ZPOOLNAME" \
+        | xargs -rn1 zfs destroy -v
 }
 
 function main {