hi all
I have this script ...
!/bin/sh
ADMIN="[email protected]"
set alert level 20% is default
ALERT=20 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) partition=$(echo $output | awk '{ print $2 }' ) if [ $usep -ge $ALERT ]; then echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" | mail -s "Alert: Almost out of disk space $usep" $ADMIN fi done
now I want that instead of sending me an email alert with the disk space .... I want to filter only those with the largest unused space (more blank discs) then I would choose random (more blank discs) 4 discs ... and assign them to the storage nodes
thanks for help