We can use "df" to check if a Linux server space is full or not. Script below will send an email out when when it reaches the threshold.
#Script to check if a space partition is 80% full
threshold=80
shareLoc='/path/to/partition' # such as the one for $APPLCSF of Oracle EBS
spacesize=`df -h | grep $shareLoc | awk '{print $5}' | tr -cd '[[:digit:]]'`
spacepercent=`df -h | grep /tmpshrs/ebsarupgradeTEMP | awk '{print $5}'`
freesize=`df -h | grep /tmpshrs/ebsarupgradeTEMP | awk '{print $4}'`
if [ $spacesize -gt $threshold ]; then
echo "$shareLoc is too large" | mailx -s "Warning: $shareLoc is ${spacepercent} full" email@address.com
echo "Email sent."
else
echo "$shareLoc has $freesize free. Used $spacepercent "
fi
No comments:
Post a Comment