Add zfs_trim.sh

This commit is contained in:
Alice Gaudon 2023-06-05 15:46:45 +02:00
parent 677a72700d
commit 825edbe388

17
zfs_trim.sh Executable file
View File

@ -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"