Operating System - Linux
1753623 Members
5814 Online
108797 Solutions
New Discussion юеВ

Re: excluding "/" from filesystem check script

 
SOLVED
Go to solution
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
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 ***
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...
Tim Nelson
Honored Contributor

Re: excluding "/" from filesystem check script

or

bdf|grep -v /dev/vg00/lvol3

JLee_1
Advisor

Re: excluding "/" from filesystem check script

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

Thanks a lot
JLee_1
Advisor

Re: excluding "/" from filesystem check script

thank you, all