Disk space script

Hi all,

Can any one help me in making a disk space script in solaris 8/9

for instance i only want to get those partitions whose diskspace has exceed 70%.

Any volunteer?

Cheers!

BR/asad

Adapt and try the following script (based on the output of cygwin df where Use% is column 5):

df -k | awk -v limit=70 'NR>1 && int($5)>limit'

Jean-Pierre.

On Solaris with bash:

while read;read fi kb us av ca mo;do [ "${ca%\%}" -gt 70 ]&&echo "$mo is at $ca";done< <(df -k)

Hi Thanks for the help

but i am only getting one result in return for partitions greater than 70 although there are 3 in all, for the code u send me

while read;read fi kb us av ca mo;do [ "${ca%\%}" -gt 70 ]&&echo "$mo is at $ca";done< <(df -k)

for instance,

/dev/vx/dsk/var 2053605 1423190 568807 72% /var
/dev/vx/dsk/MMC-DG-00/oracle-ms-00-03
68157440 55539920 12519016 82% /opt/oradata03
/dev/vx/dsk/MMC-DG-00/oracle-ms-00-02
115343360 82241464 32843296 72% /opt/oradata02

but it only returns

/dev/vx/dsk/MMC-DG-00/oracle-ms-00-03
68157440 55539920 12519016 82% /opt/oradata03

Can u help out why it is doing so?

BR/Asad

have you also tried the awk method?

Its also does not work;

# df -k | awk -v limit=70 'NR>1 && int($5)>limit'
awk: syntax error near line 1
awk: bailing out near line 1

use nawk in place of awk.

Cheers! Its done..Thanks a lot for making it happen...
BR/Asad

Yes, the code I posted won't work with long mount points :slight_smile:

Use this:

while read fs kb us av ca mo;do 
        case $kb in 
                "")read kb us av ca mo;; 
                "kbytes")continue;;
        esac
        [ "${ca%\%}" -gt 70 ]&&echo "$mo is at $ca"
done< <(df -k)