#!/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"