Mr. B-o-b,
I came across this post while looking for a similar solution. I've written an emailer back-end for our FTP server. It relies heavily on shell scripting to tell when files are transferred. For files being put on the FTP server by local users(Drag & Dropped to a samba share from windows boxes), it looks for locked files via smbstatus -L. For files downloaded by vendors another script polls FTP connections with netstat -A inet -tn | grep $localip:21. Cloogy at best, but it does work. We have over 700 users, of which over 300 users are active in any given 90 day period.
I've been looking at inotify-tools for a while but was stuck with the same problem too many notifications. I've since discovered that it may not work for me. With 700 directories, each having 2 subdirectories, I get a LOT of Q_OVERFLOW errors. However, Your script gave me an idea. I have only been messing with it for a few minutes, but you could use something like this for testing.
Code:
#! /bin/ksh
clear
inotifywait --timefmt %H:%M:%S --format %e,%T,%w%f -m -r -e open,close /ftp/*/outgoing | while read line
do
file=`echo "$line" | egrep -v "ISDIR"`
if [ ! -z "$file" ]
then
echo "FILE: $file"
fi
done
The grep -v "ISDIR" will eliminate directory listing notifications. I'm using egrep only to facilitate adding more events to exclude. In order to eliminate more events simply change the line to something like this
Code:
egrep -v "ISDIR|OPEN"
This will filter both out. You can fine tune between the events your looking for and the grep statement to get the best output. Depending on what's left you can create
if or
case statements that can act on the event(s). Then if the criteria is met, send the email. This should greatly reduce the number of emails sent.
Hope it helps.
Addendum: How are files being transferred back and forth from your system? There are other push type methods of tracking file transfers other than inotify.