[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] Cron and Email



> How do I set up a crontab to email me if say a new file comes into the
> ftp/incoming directory?

set up a crontab entry to run a script.
The script could do the following:
 mv /tmp/ftplist.current /tmp.ftplist.old
 ls -l /ftp/incoming > /tmp/ftplist.current
 diff /tmp/ftplist.current /tmp/ftplist.old > /tmp/ftplist.diff
 if [ -x /tmp/ftplist.diff ]
   mail user@xxxxxxxxxx
 fi 


That's just an example of an inefficient hack that gets the job done.
I'm not sure about the syntax of the "if" line - you want to 
check if the file is not zero-length - and the mail command needs a
flag to send the diff file as the body of the message.

But you can type "man mail" just as well as I can.