Skip to content

Commit

Permalink
Reverse sort by creation to delete children first
Browse files Browse the repository at this point in the history
  • Loading branch information
Heavybullets8 committed Oct 30, 2024
1 parent c39dbb8 commit 205099c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cleanup_snapshots() {
echo "Starting cleanup on pool: $ZFS_POOL"
echo "===================================================="

mapfile -t snapshot_clone_pairs < <(zfs list -H -t snapshot -o name,clones -r "$ZFS_POOL")
mapfile -t snapshot_clone_pairs < <(zfs list -H -t snapshot -o name,clones -S creation -r "$ZFS_POOL")

for line in "${snapshot_clone_pairs[@]}"; do
snapshot=$(echo "$line" | awk -F'\t' '{print $1}')
Expand Down

0 comments on commit 205099c

Please sign in to comment.