<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Galen Johnson a écrit :
<blockquote
cite="mid:BBA15439DC467648BBAB71E6BA4D9900381EFDC947@MERCMBX12.na.sas.com"
type="cite">
<pre wrap="">If you want to check that a directory doesn't exist, why not use Xymon's builtin functionality?
-----Original Message-----
From: Kip, D. - GDI/SNB [<a class="moz-txt-link-freetext" href="mailto:d.kip@gdi.minjus.nl">mailto:d.kip@gdi.minjus.nl</a>]
Sent: Thursday, February 26, 2009 11:29 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</a>
Subject: RE: [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 [<a class="moz-txt-link-freetext" href="mailto:doctor@makelofine.org">mailto:doctor@makelofine.org</a>]
Verzonden: donderdag 26 februari 2009 14:18
Aan: <a class="moz-txt-link-abbreviated" href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</a>
Onderwerp: Re: [hobbit] directory test
Henrik Størner a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">On Wed, Feb 25, 2009 at 02:29:28PM +0100, dOCtoR MADneSs wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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).
</pre>
</blockquote>
<pre wrap="">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
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
</pre>
</blockquote>
<pre wrap=""><!---->Thanks for your answer, unfortunately this didn't work.
If I replace
file:`find /tata -name toto_*` with
with
<a class="moz-txt-link-freetext" href="file:$(find">file:$(find</a> /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 <a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
To unsubscribe from the hobbit list, send an e-mail to
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
To unsubscribe from the hobbit list, send an e-mail to
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
</pre>
</blockquote>
That's I want to do. I'd like to check the existence of a directory,
and get yellow status if the directory exists. The difficulty is that
the directory name is variable, it begins with toto_ and is followed by
a random value.<br>
So my first question was :<br>
How to use the "files" test to check it.<br>
<br>
</body>
</html>