[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Monitor the number of files in a directory?
From: |
Edward A. Muller |
Subject: |
Re: Monitor the number of files in a directory? |
Date: |
Sun, 7 Jan 2007 23:17:52 -0600 (CST) |
FYI: I ended up using the following script...
#!/bin/bash
LIMIT=50
NUM=`ls -l <file> | wc -l`
if [ $NUM -gt $LIMIT ]
the
touch <other file>
fi
This way I can use the following monit config...
check file mailman_qfiles with path <other file>
start program = ....
stop program = ...
if changed timestamp then restart
----- Original Message -----
From: Chris Metcalf <address@hidden>
To: This is the general mailing list for monit <address@hidden>
Sent: Sunday, January 7, 2007 1:54:19 PM GMT-0600 US/Central
Subject: Re: Monitor the number of files in a directory?
I like that idea. You could use the same model for arbitrary
monitoring scripts, it would seem.
- Chris
On 1/7/07, Pavel Urban <address@hidden> wrote:
> Edward A. Muller wrote:
> > Any idea on how I can use monit to monitor the number of files in a
> > directory?
> >
> > Mailman for some of our customers goes bonkers sometimes and just stops
> > processing mail in the $MAILMANHOME/qfiles/out directory. Restarting
> > mailman fixes the problem. I'd like to use monit to restart Mailman should
> > the number of files in the qfiles/out directory reaches something like 50
> > or 100 files.
> >
>
> #!/bin/bash
> LIMIT=your_limit
> NUM=`ls -1 directory |wc -l`
> if [ $NUM -lt $LIMIT ]
> then
> touch /var/tmp/flagfile
> fi
>
> run this script via cron (for example, every 20 minutes) and do
> timestamp check on /var/tmp/flagfile (or any file you decide).
>
> --
> ***********************************************************************
> Pavel Urban (address@hidden)
> O2 system disaster
> Telefonica O2 Czech Republic, a.s. - www.cz.o2.com
> ***********************************************************************
> Vegetables should not operate electronic equipment.
> Computer Stupidities, http://rinkworks.com/stupid/
> ***********************************************************************
>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
>
--
Chris Metcalf
address@hidden
http://chrismetcalf.net
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
Good Luck & God Speed,
Edward Muller
Owner - Interlix, LLC
417.862.0573
http://interlix.com