Script to monitor a Filesystem on AIX

#!/bin/sh

# This script checks if the /siebel filesystem reaches 2 GB of free space
# And then delete the old logs except those of today

warninglimit=2097152    # This number is in KB, it’s equal to 2 GB,
                        # KB is used to avoid floating point numbers

filesystems=”/siebel”   # List of filesystems to be monitored, separated by
                        # blank spaces

for fs in $filesystems  # Loop on the list of filesystems above
do
        size=`df -k $fs|grep $fs|awk ‘{ print $3; }’`   # Extract size of
                                                        # Filesystem in KB
        if [ $size -le $warninglimit ]  # If fs size is less than warning lim.
        then
                echo “WARNING: Low disk space for $fs ($size)”
                # Add what to delete here
        fi
done

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

1 Response to Script to monitor a Filesystem on AIX

  1. very handy script, thanks.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s