Tuesday, March 31, 2020

Script to send diskspace warning EMail

Script

#!/bin/bash

SPACE=`df -Pk | sed -n '/\/$/p' | gawk '{print $5}' | sed 's/%/ /'`

if [ $SPACE -ge 85 ]
then
        echo "Disk space on root at $SPACE% used" | mail -s "Disk warning" kirands@yahoo.com
        echo "Disk space on root at $SPACE% used"
fi





No comments:

Post a Comment