new file notification

Peter pmatulis at sympatico.ca
Sat Feb 17 05:35:50 UTC 2007


Le Samedi 17 Février 2007 00:28, Peter a écrit :
> Le Vendredi 16 Février 2007 23:35, csevern at pacesetterglobal.com a
>
> écrit :
> > I have been looking for some kind of freebsd software that will
> > monitor specific directories and then email notify an email address
> > when new files have been added.
> >
> > I have searched the ports tree with no success. If anyone has an
> > idea of a solution and/or a combanation of ports that will achieve
> > this task, i would appreciate it very much.
>
> Why not a simple shell script run with cron?
>
> Hint:
>
> DIR=/path/to/target
> OLD_FILES=/var/filescheck/number
> NEW_FILES=$(ls -al $DIR | grep ^- | wc -l)
>
> if [ $NEW_FILES gt $OLD_FILES ];then
>   mail -s "new files found in $DIR" user at mail.com < /dev/null
> fi
>
> echo $NEW_FILES > $OLD_FILES

Mistake in there.  You need to cat $OLD_FILES....


More information about the freebsd-questions mailing list