From 825edbe388e46adbd81ffeb8f495c34aa158d77d Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 5 Jun 2023 15:46:45 +0200 Subject: [PATCH] Add zfs_trim.sh --- zfs_trim.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 zfs_trim.sh diff --git a/zfs_trim.sh b/zfs_trim.sh new file mode 100755 index 0000000..af8060c --- /dev/null +++ b/zfs_trim.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# ZFS Trim script + +POOLS=($(cat ~/.zfs_trim_pools)) +POOLS_STR="" + +for pool in "${POOLS[@]}"; do + echo "Trim $pool" + zpool trim $pool + POOLS_STR="$POOLS_STR$pool " +done + +OUTPUT=$(zpool status -t) + +echo "Sending mail..." +echo -e "Started trim procedure for $POOLS_STR\n\n$OUTPUT" | $(dirname $0)/mail.sh "ZFS Trim - $(hostname)" +echo "Done"