Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
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 ...
  1. #1
    Just 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?

  2. #2
    Just 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.

  3. #3
    Just 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.

  4. #4
    Just 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.

  5. #5
    Just Joined!
    Join Date
    Nov 2009
    Posts
    20

    urgent

    can you send me how to do it rapidly?

  6. #6
    Just 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,

  7. #7
    Just 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.
    Code:
     # nano script
    The script
    Code:
    du /home/test/folder >> /home/test/foldersize.log
    Code:
    # chmod +x script
    Then setup a cron job to run it how ever often you need.
    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/

  8. #8
    Just 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.

  9. #9
    Just 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?

  10. #10
    Just 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.

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...