monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File kind presence


From: Callum Macdonald
Subject: Re: File kind presence
Date: Sat, 16 Jun 2012 00:12:12 +0200

I don't think such a test exists in monit, however, I think you could
create a fairly simple test using the `find` command. Something like
this might work:
find -type f -name "*.txt"

I think this is the relevant part of the man page:
http://mmonit.com/monit/documentation/monit.html#program_status_testing

Something like this *might* work (it's totally untested):
check program txtfilecheck with path "/usr/bin/find /home/foo -type f
-name '*.txt'"
        if status != 0 then alert

Actually, that probably won't work, because I find will exit with status
0 whether or not it finds a file. However, you could wrap find in a
bash / sh script that would return an exit code, or maybe there's an
option to change find's exit status.

Anyway, I think that's the general idea of what will work for you.

Cheers - Callum.

On Fri, 2012-06-15 at 23:17 +0200, Simone D. wrote:
> Hello,
> is it possible for monit to check the existence of some file with 
> particular extension?
> 
> For example:
> i want to be sure that there isn't ANY file .txt in my directory 
> /home/foo/ (and in its sub-directories). If there is at least one I want 
> monit to alert me
> 
> Looking into docs I found the rule to check the existence of a specific 
> file but i didn't find anythign about a "general rule".
> 
> Thank you very much,
> Simone
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

[Prev in Thread] Current Thread [Next in Thread]