How much disk space ya left …??

I gotta something… something wacky this time….

When one of our dear employee asked ” Is there any script to know the disk
usage of the system I am using….”

well….I snip one and it’s working fine…

++ Those who S [ ] I T before GATE, please excUse…

=====================================================

This shell script will help us to monitor the disk usage
If any of the disk partiotion space is more than 95%, all the users who were
logged into the system will get an ALERT message
Add the below line to “crontab -e” to run the program for every minute
*/1 * * * * sh /ya/path/to/diskUsage.sh
YMMV and if ya find any issue; please..try it out by yourself ‘/ ‘
tfeLYpoC

#! /bin/bash

df -h | grep -iv used |grep -iv media | awk ‘{print $6″ ” $5}’ |
while read ROW;
do PERCY=`echo $ROW | cut -d”%” -f1 | awk ‘{print $2}’`
if [ $PERCY -gt 95 ]; then
wall -n “ALERT..! from `hostname`
$ROW of the partition is FULL…! ”
fi
done

Leave a Reply