server-scripts/zfs_trim.sh

18 lines
349 B
Bash
Raw Normal View History

2023-06-05 15:46:45 +02:00
#!/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"