monit-general
[Top][All Lists]
Advanced

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

Re: File kind presence


From: Simone D.
Subject: Re: File kind presence
Date: Sat, 16 Jun 2012 10:52:36 +0200
User-agent: Postbox 3.0.3 (Macintosh/20120304)

Thank you very much Callum, I will do in this way (with a shell script)
16 giugno 2012 00:12
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.
15 giugno 2012 23:17
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



reply via email to

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