Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

excluding "/" from filesystem check script

 
SOLVED
Go to solution
Highlighted
JLee_1
Advisor

excluding "/" from filesystem check script

Hi -

I'm using a shell script to monitor filesystems and alert via email when they reach a certain capacity. I'm trying to exclude the root filesystem with a 'grep -v', but when I do it's exluding all filesystems and I don't get alerted on anything. I was wondering if someone could check the syntax on this and maybe point me in the right direction. Thanks in advance for your help.

# Main body
#----------

if [[ -n `bdf | grep -v -e / | grep -e "8[5-9]%" -e "9[0-9]%" -e "100%"` ]]
then
bdf | grep -e "8[5-9]%" -e "9[0-9]%" -e "100%" | \


5 REPLIES 5
Highlighted
V. Nyga
Honored Contributor
Solution

Re: excluding "/" from filesystem check script

Hi,

if you exclude '/', then you exclude everything under '/' - and ALL is under '/'!
Maybe this works like you want - eclude the logical volume of '/': bdf|grep -v -e lvol3

(lvol3 is in my case the logical volume of '/' - but this is also the standard)

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Highlighted
James R. Ferguson
Acclaimed Contributor

Re: excluding "/" from filesystem check script

Hi:

If you want to use 'grep' to exclude the '/' mountpoint, do:

# bdf | grep -v "/$"

...the '$' anchors to the end of the line.

Regards!

...JRF...
Highlighted
Tim Nelson
Honored Contributor

Re: excluding "/" from filesystem check script

or

bdf|grep -v /dev/vg00/lvol3

Highlighted
JLee_1
Advisor

Re: excluding "/" from filesystem check script

Thanks for quick replies everyone! Working like a charm now..

Thanks a lot
Highlighted
JLee_1
Advisor

Re: excluding "/" from filesystem check script

thank you, all