Script "email notification"
I need to have a script that does the following:
1. Receive an email notifying me that a file has been uploaded to my server 2. Date and Time of upload + the location of the file i am asking this bcoz i notice that some one is able to upload a mail() file which has caused my server to crash, i just managed to clean my queue which contained 116720 files!! i am not really sure how did that happened, but with the script above i can win some time in order to find the bug. Thanks in advance. |
The most common approach would be to check the log file.
The another approach is to install a cron job script that checks for differences in the file system. This can take long, if you want to check the entire file system. Or just an additional function to your upload script (if the uploaded files have been done by one of your existing scripts) to write a log. As a matter of fact, log writing makes more sense. In your example with the 116720 files that would mean to send you 116720 e-mails. Flooding your mail box is not a good idea. |
It's only one file uploaded that sent tons of emails, so by my calculation, one upload = one email.
Look into incrontab. It let's you monitor directories for changes (such as file creation), and you could use that quite simply to send you a message. Think crontab based on inode changes rather than time. |
Quote:
not exactly, one upload file = tons of emails, basically i will be receiving one or two emails max |
1 Attachment(s)
Quote:
i have attached a sample file that are being uploaded into my web directory. Thanks in advance |
I'll send you here (http://linux.die.net/man/5/incrontab) for a start, but basically, incrontab allows you to monitor /var/www or any other directory for files created, modified, or whatever you want, an then to perform some action. In your case, tha action would be to send a mail message with the file name.
|
All times are GMT -5. The time now is 08:23 PM. |