Only to use: /usr/bin/test `find /var/spool/mqueue -type f -name 'q*' | wc -l` -ge 12
instead of ls and grep and expr. ;] Russell On Thu, Mar 10, 2005 at 03:49:10PM -0500, nathan r. hruby wrote: > 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 <[EMAIL PROTECTED]> > uga enterprise information technology services > production systems support > metaphysically wrinkle-free > ------------------------------------------- > > > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@gnu.org > http://lists.gnu.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine