AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  file system to reach 90% - Script

    Posted Wed September 01, 2010 10:35 AM

    Originally posted by: raja7


    Hi All,

    Please send any script to intimate the file system to reach 90%.

    Kindly guide me...

    Raja
    #AIX-Forum


  • 2.  Re: file system to reach 90% - Script

    Posted Wed September 01, 2010 12:49 PM

    Originally posted by: broberts


    cat /dev/zero > zero.file

    Go get some tea. When the system errors saying "No space left on device," it hit 100%. If you want to catch it at 90%, open another window, run df. When you see it get to 90%... hit ctrl-c on the one that you're running the cat on.
    #AIX-Forum


  • 3.  Re: file system to reach 90% - Script

    Posted Thu September 02, 2010 08:19 AM

    Originally posted by: Carlyle


    This has not been tested in its entirety
    
    #!/usr/bin/ksh [[ -z $1 ]] && echo requires FS as parameter && exit 1 typeset FS=$1 typeset blocks lsfs $FS || exit 1 df $FS | tail -1 | read x Tblocks Fblocks x [[ $
    {Tblocks
    }$
    {Fblocks
    } != +([[:digit:]]) ]] && echo $Tblocks or $Fblocks is nonnumeric && exit 1 typeset FILL=$(((Tblocks*9/10+1)-Tblocks+Fblocks)) ((FILL <= 0 )) && echo $FS is already at least 90% && exit 1 dd if=/dev/zero count=$FILL > $FS/fillerfile
    

    #AIX-Forum


  • 4.  Re: file system to reach 90% - Script

    Posted Thu September 09, 2010 05:32 PM

    Originally posted by: sandy_kokkirala


    #!/bin/ksh
    #
    1. This script will send an email if the file system size exceeds 90% with below details
    2. It will include filesytem name and how much size it contains with the hostname
    3. Updated on 09/09/2010 by sandeep.kokkirala@in.ibm.com
    #
    for i in `df -g|awk '{if(NR>1) print $4":" $7}'`
    do
    k=`echo $i|cut -d":" -f1 2>/dev/null`
    l=`echo $i|cut -d":" -f2 2>/dev/null`
    z=${k%*\%}
    if $z -gt 90 2>/dev/null
    then
    echo "The file system $l exceded 50% size now it contains $z% size for `hostname` please take action as soon as you this"|mail -s "Action Needed" \
    sandeep.kokkirala@in.ibm.com
    fi
    done
    #AIX-Forum


  • 5.  Re: file system to reach 90% - Script

    Posted Fri September 10, 2010 03:15 AM

    Originally posted by: OTIT


    I copied the script of sandy_kokkirala, edit, test and its can be used.

    Thank for sandy_kokkirala.

    #############################################################

    for i in `df -g|grep -v proc |awk '{if(NR>1) print $4":" $7}'`
    do
    a=`echo $i|cut -d":" -f1 2>/dev/null`
    k=`echo $a|cut -d"%" -f1 2>/dev/null`
    x=`expr $k + 0`
    l=`echo $i|cut -d":" -f2 2>/dev/null`

    if [ $x -gt 90 ]
    then
    echo "The file system \"$l\" exceded 90% size now it contains $a size for \"`hostname`\" please take action as soon as you this" "|mail -s "Action Needed" sandeep.kokkirala@in.ibm.com

    fi
    done
    #AIX-Forum


  • 6.  Re: file system to reach 90% - Script

    Posted Fri October 08, 2010 12:48 PM

    Originally posted by: MisterX


    I prefer to use the built-in RSCT functions. check out lscondition "/var space used". This can be done via command line, but it's easier/quicker if you can run WSM from an X-Session.
    #AIX-Forum