Xymon Mailing List Archive search

to test the non-existence of a dir

list dOCtoR MADneSs
Tue, 31 Mar 2009 16:50:28 +0200
Message-Id: <user-a87b40117f6a@xymon.invalid>

Josh Luthman a écrit :
Off the top of my head I think you want something like,

if {-d /this/subdir}
echo BBVAR=green
else
echo BBVAR=red

I'm sure I'm missing a lot, not looking at it right now.  Pretty sure 
-d tests directories.

Josh Luthman
Office: XXX-XXX-XXXX
Direct: XXX-XXX-XXXX
XXXX Wayne St
Suite XXXX
Troy, OH XXXXX

Those who don't understand UNIX are condemned to reinvent it, poorly.
--- Henry Spencer


On Tue, Mar 31, 2009 at 10:29 AM, dOCtoR MADneSs 
<user-d54077869176@xymon.invalid <mailto:user-d54077869176@xymon.invalid>> wrote:

    Hi,

    Xymon allow me to test the non existence of file or directory. But
    I'd like a more complex test. In my case, I don't want any
    directory named _FIXED_PART_anything in a whole tree.
    Example :

    I've
    /toto/_FIXED_PART_1 -> test is red
    /toto/a/sub/directory/_FIXED_PART_hello_world -> test is red

    So, is there a "normal" way to use "files"  test included in xymon ?

    Regards,
    Damien

A shell script should look like this :

find $TREE -type d -name _FIXED_PART_\*
if [ $? -eq 0 ] ; then
    BBVAR=red
else
    BBVAR=green
fi

But i prefer to use integrated "files" test