| 1234567891011121314151617181920212223242526 |
- #!/bin/bash
- #########################################################################
- # Script for check FREE SPACE #
- # Created by PM-DoIT #
- # ver 0.1 #
- #########################################################################
- #----------------------------- VARIABLES -------------------------------#
- YOURMAIL="info@doit.sk, helpdesk@itline.sk"
- TRESHOLD="90"
- SRV=$(hostname -s)
- DAT=$(date)
- LOG="/tmp/var.tmp"
- #------------------------------ CORE -----------------------------------#
- clear
- SIZE=$(df -h | grep -w "/" | awk '{print $5}' | sed 's/%//g')
- if [ "$SIZE" -ge "$TRESHOLD" ];
- then
- echo -e "- Free space exceeded [\e[1;33m$TRESHOLD%\e[0m / \e[1;31m$SIZE%\e[0m]"
- du /var -h -d1 | sort -srh > $LOG
- mutt -s "LOW space [$SRV] consumed ($SIZE%)" "$YOURMAIL" <$LOG
- cat $LOG | column -t
- else
- echo -e "- Free space is OK [\e[1;33m$TRESHOLD%\e[0m / \e[1;32m$SIZE%\e[0m]"
- fi
|