[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [hobbit] directory test
- To: <hobbit (at) hswn.dk>
- Subject: RE: [hobbit] directory test
- From: "Kip, D. - GDI/SNB" <d.kip (at) gdi.minjus.nl>
- Date: Thu, 26 Feb 2009 17:29:20 +0100
- References: <49A547B8.7050904 (at) makelofine.org> <20090226105933.GK2957 (at) osiris.hswn.dk> <49A6968E.4030708 (at) makelofine.org>
- Thread-index: AcmYFNZZMI2zDB5nQXWvno5L/KVM7gAAOc/Q
- Thread-topic: [hobbit] directory test
Your find is looking for the existence of the directory, not the non-existence.
So the green status is correct.
Change it to an 'if' statement like
if [ $(find /tata -d -name toto_*) ]; then echo &red ; else echo &green ; fi
Or something similar
Alternatively, you can look into the correct useage of the '!'-operator (boolean NOT) in your 'find' expression.
I could not find the correct way to use it quick enough, sorry.
-----Oorspronkelijk bericht-----
Van: dOCtoR MADneSs [mailto:doctor (at) makelofine.org]
Verzonden: donderdag 26 februari 2009 14:18
Aan: hobbit (at) hswn.dk
Onderwerp: Re: [hobbit] directory test
Henrik Størner a écrit :
> On Wed, Feb 25, 2009 at 02:29:28PM +0100, dOCtoR MADneSs wrote:
>> I'm using actually xymon 4.2.3. I check for presence of some files
>> (red if present, else green ), and it's working very well.
>> I'd like to do almost same test with directory. Final objective is :
>> if there is any directory called toto_ANYTHING in /tata (to any level
>> in the directory hierarchy of /tata, I'd like yellow result, else
>> green result).
>
> Not sure if it will work, but I'd start with something like
> [host]
> file:`find /tata -name toto_*`
> That gives you a list of the files you're looking for. And then in
> hobbit-clients.cfg you would have
>
> HOST=host
> FILE %^/tata/toto_ yellow noexist
>
>
> Regards,
> Henrik
>
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe (at) hswn.dk
>
>
Thanks for your answer, unfortunately this didn't work.
If I replace
file:`find /tata -name toto_*` with
with
file:$(find /tata -name toto_*) I can get :
green $(find /tata -type d -name toto_*) But it's wrong, I have a toto_test directory in /tata
So, I don't think it's the appropriate solution
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe (at) hswn.dk