MOnitor the presence of a file in a directory


I wanted to monitor the presence of a file in a directory, How do I do that?


what about writing your own script in perl/shell/python to do that ? :wink:

if -f $FILE ]]; then
echo "File $FILE present"
exit 0
echo "File $FILE absent"
exit 2

(I just wrote it, so it may not work as it is, but you’ve got the idea now :))


or you could just use check_file_age and put a really massive age limit on the file, like 3000000000 secs or something (>95 yrs)… this check will show a critical status if the file is missing

[[email protected] libexec]# ./check_file_age -w 3000000000 -c 3000000001 test.txt
FILE_AGE OK: test.txt is 6479845 seconds old and 7467 bytes
[[email protected] libexec]# ./check_file_age -w 3000000000 -c 3000000001 test.txs
FILE_AGE CRITICAL: File not found - test.txs
[[email protected] libexec]#