Results 1 to 10 of 21
I have a folder that is received files each ten minutes, how can i verify if the folder does not receive any files ?knowing that the files do not stay ...
- 11-03-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 20
othermike
I have a folder that is received files each ten minutes, how can i verify if the folder does not receive any files ?knowing that the files do not stay in the folder for a long time?
- 11-03-2009 #2Just Joined!
- Join Date
- Oct 2007
- Posts
- 19
What about setting up a cron job to run every few minutes that would output the list of the folders contents into a log file. Perhaps then email you a report every day and clear the log.
Surely not the cleanest way to do it, but I think it would work.
- 11-04-2009 #3Just Joined!
- Join Date
- Nov 2009
- Posts
- 20
Urgent
i see what you mean, but how can i know the folder has received a file, to make the matters worse the file does not not stay for a long time in the folder and i want to receive a mail as soon as we dont have files in the folder after 15 minutes.
- 11-04-2009 #4Just Joined!
- Join Date
- Oct 2007
- Posts
- 19
You could have a cron run as often as you need, say every 10 seconds. Have it check the size of the folder with 'du /path/to/folder' and output that to a log file. You can then analyze what the size of the folder is, and if it is above a certain size send you an email to alert you.
- 11-04-2009 #5Just Joined!
- Join Date
- Nov 2009
- Posts
- 20
urgent
can you send me how to do it rapidly?
- 11-04-2009 #6Just Joined!
- Join Date
- Nov 2009
- Posts
- 20
ok
i am writing a script on that ,i am testing it ,thanks a lot for your help i will let u know.
BEST Regards,
- 11-04-2009 #7Just Joined!
- Join Date
- Oct 2007
- Posts
- 19
I am by no means a scripting guru, so if anyone else would like to help or provide some guidance, that would be great.
What I would try to do though would be to create one script that will check the folder size, make it executable, and then add it to a cron job.
The scriptCode:# nano script
Code:du /home/test/folder >> /home/test/foldersize.log
Then setup a cron job to run it how ever often you need.Code:# chmod +x script
Here is a site with info on that
adminschoice.com/docs/crontab.htm
Then create another script that tails the last few lines of the log and alerts you if the number changes. It would also likely be good to clean up the log file with this one or another.
I am also sure there is a much easier way to do this all in one script, so feel free to check out this site to come up with one. Unless of course someone else wants to write it for you.
freeos.com/guides/lsst/
- 11-04-2009 #8Just Joined!
- Join Date
- Oct 2007
- Posts
- 19
Let us know how your scripting goes.
If you want to post your final results here also, someone else may benefit from your work.
- 11-04-2009 #9Just Joined!
- Join Date
- Nov 2009
- Posts
- 20
urgent
i did what you told me but i can not compare the result of tail?
how can i do it?
- 11-04-2009 #10Just Joined!
- Join Date
- Oct 2007
- Posts
- 19
You would need to write a script to compare the log file entries. It shouldn't be so very hard, but I don't have a lot of experience scripting, so it would take me a good deal longer than someone with experience.
How are the files being transferred to the folder? If it is FTP we may be able to look to the log there instead of trying to reinvent something that already exists.


Reply With Quote