Summary Controlling the FS size

From: Modrego K. SBD <ModregoK_at_bancsabadell.com>
Date: Tue Jul 31 2001 - 08:10:14 EDT
	Hi again.. Thanks to;

Davorin Bengez
Dietsch, Nathan
Fletcher, Joe
Phillips, John

Finally i use the script that sent to me Davorin Bengez..

Other suggestions are to use aplication such BigBrother or bcnu, but i =
have another monitoring aplication to do this..

Thanks once again!..

Hi, basically I use something like:

---8<---
#!/bin/sh
# check free space in given filesystem

# Configurables
#

## The filesystem we are looking after
FS=3D/usr

## max usage allowed (in %)
MAX_USE=3D20

## whom shall we alarm when it happens
MAIL_ADDR=3Dadmin@somewhere.com=20

#
# end of configurables
#

LOCKFILE=3D/tmp/check-fs
FS2=3D`echo $FS | sed -e 's/\//\\\\\//g'`

if [ "x$HOSTNAME" =3D "x" ]
then
        HOSTNAME=3D`/bin/hostname`
fi

USE=3D`df -k | awk '$6 ~ /^'$FS2'$/ {print $5}'` 2>/dev/null

if [ "x$USE" =3D "x" ]
then
        echo "$0: oops, I should not be here... df returned nothing..."
        exit 1
fi

USE=3D`echo $USE | sed 's/%//'`

if [ $USE -gt $MAX_USE ]
then
        if [ -f $LOCKFILE ]
        then
                exit 0
        fi

        mailx -s "$FS filesystem $USE% used ($MAX_USE% allowed)!" =
$MAIL_ADDR <<EOF
Danger! Danger!

$FS filesystem on $HOSTNAME has filled up above preset limit
( $USE%  available, limit is $MAX_USE% )
Please do something.
EOF

touch $LOCKFILE

else
        if [ -f $LOCKFILE ]
        then
                rm -f $LOCKFILE
                exit 0
        fi
fi
exit 0
---8<---
Received on Tue Jul 31 13:10:14 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:25:00 EDT