Newbie - Checking directory for files
Jason Martin
jhmartin at toger.us
Tue Dec 14 17:09:16 CET 2004
On Tue, Dec 14, 2004 at 10:47:59AM +0000, Tom.Corcoran at meridianp2p.com wrote:
> How can I get a plugin to constantly check a folder for the existence of
> error files and to alert me as long as the files exist in the directory.
> Any help would be greatly appreciated.
You'd have to write a plugin for that. It should be fairily
simple, something like:
#!/bin/sh
FILES=`ls -l /some/dir/*.files|wc -l`
if [ $FILES -gt 0 ]; then
echo "Error files found!"
exit 2
else
echo "No error files found"
exit 0
fi
Of course you'd probably want to spruce that up to use
command-line arguments instead of hardcoded values, but you get
the idea. Plugins are actually very easy to write -- it only
gets hard when you want the plugin to work on every platform
in existence in any possible configuration.
-Jason Martin
--
Only 19,999 lines of C++ to my next ski trip...
This message is PGP/MIME signed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 211 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20041214/2a64df9e/attachment.sig>
More information about the Users
mailing list