[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Number of files in a directory?
From: |
nathan r. hruby |
Subject: |
Number of files in a directory? |
Date: |
Thu, 10 Mar 2005 15:49:10 -0500 (EST) |
Hi,
Here's something that I'm sure someone else has solved..
I'd like to monitor the number of files in /var/spool/mqueue and do 3
things when it hits a threshold:
- Fire off a warning
- run sendmail -q
- Run a shell command to nuke some things (like SPAM!)
So, here's what I have now, which seems fairly inelegant:
----BEGIN SNIP
classes:
# See if we're overlimt
MailqueOverLimit = ( ReturnsZero(/bin/sh -c "expr `ls /var/spool/mqueue/ | grep
q.*| wc -l` \> 12 > /dev/null") )
alerts:
# Tell us if we're overlimit (it'd be nice to have the actual
# number...)
MailqueOverLimit::
"WARNING: Mail queue is overlimit on $(fqhost)" ifelapsed=60
shellcommands:
# Do something to make us not overlimit
MailqueOverLimit::
"$(nuke_spam_bounces)"
"$(run_a_qrunner)"
----END SNIP
This seems kinda like a kludge. Anyone have any better suggestions for
monitoring the number of files in a directory?
Thanks!
-n
--
-------------------------------------------
nathan hruby <nhruby@uga.edu>
uga enterprise information technology services
production systems support
metaphysically wrinkle-free
-------------------------------------------
- Number of files in a directory?,
nathan r. hruby <=
- Re: Number of files in a directory?, Adams, Russell L., 2005/03/10
- Re: Number of files in a directory?, Tim Nelson, 2005/03/10
- Re: Number of files in a directory?, nathan r. hruby, 2005/03/10
- Re: Number of files in a directory?, Tim Nelson, 2005/03/14
- Re: Number of files in a directory?, Mark Burgess, 2005/03/15
- Re: Number of files in a directory?, nathan r. hruby, 2005/03/15
- Re: Number of files in a directory?, Mark Burgess, 2005/03/15
- Re: Number of files in a directory?, Tim Nelson, 2005/03/16
Re: Number of files in a directory?, Mark Foster, 2005/03/10
Re: Number of files in a directory?, Noah, 2005/03/10