<font face="arial" size="2"><p style="margin:0;padding:0;">stating the obvious, I'm sure you've tried this, but I'd start by checking for error output. Particularly, do you have spaces in $mydirs, and how are you coping with that?</p>
<p style="margin:0;padding:0;"> </p>
<p style="margin:0;padding:0;">I'd measure it like this:</p>
<div>
<div></div>
<div>find $mydirs -type f -a -cmin -10 -print > /tmp/filewatcher.count 2>/tmp/filewatcher.err</div>
<div>WC=`wc -l /tmp/filewatcher.count | awk ' { print $1 } ' `</div>
<div>if [ "$WC" -gt "0" ]; then</div>
<div>then</div>
<div>echo "`date`: Found $WC lines in filewatcher.count:"</div>
<div>we -l /tmp/filewatcher.count</div>
<div>cat -n /tmp/filewatcher.count</div>
<div>echo "Any errors?"</div>
<div>cat -n /tmp/filewatcher.err</div>
<div>echo "OK, Done. This should be enough info to start debugging the issue."</div>
<div># email me notification bla bla bla</div>
</div>
<div>[ snip ]</div>
<div>fi</div>
<div></div>
<div>I assume you're running from cron so you'll pick up the stdout by email, otherwise redirect output to a file of course. This should get you enough info to pin down the problem very quickly</div>
<div></div>
<p style="margin:0;padding:0;"> </p>
<p style="margin:0;padding:0;">-----Original Message-----<br />From: "tid" <td@bloogaloo.co.uk><br />Sent: Tuesday, October 8, 2013 10:30am<br />To: "The mailing list for the Greater London Linux User Group" <gllug@mailman.lug.org.uk><br />Subject: [GLLUG] find / shell weirdness<br /><br /></p>
<div id="SafeStyles1381241303">
<div dir="ltr">Folks,
<div>I have a small bash script which watches a number of folders for files</div>
<div>added in the last 10 minutes:</div>
<div>($mydirs below is just a list of ftp folders which clients upload to )</div>
<div>===================================================</div>
<div>
<div>find $mydirs -type f -a -cmin -10 -print > /tmp/filewatcher.count</div>
<div>if [ `wc -l /tmp/filewatcher.count | awk ' { print $1 } ' ` -gt 0 ]</div>
<div>then</div>
<div># email me notification bla bla bla</div>
</div>
<div>[ snip ]</div>
<div>fi</div>
<div>====================================================</div>
<div>So, this has been working fine but recently it's started giving me a</div>
<div>lot of false positives - i.e the 'if' statement is firing, but no files are found - is there</div>
<div>some shell expansion going of which I'm unaware, or is it the more likely PBKAC? <br /><br /></div>
Tid</div>
</div></font>