Need help with logic in creating perl script to monitor if files are being sent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonathan184
    New Member
    • Nov 2006
    • 154

    Need help with logic in creating perl script to monitor if files are being sent

    how to monitor and find out if files test1_* and test2_* files were sent in an hour and if not send an email
    This is on a unix system basically I got a cronjob that runs every sec polling a ftp dir which name dir1 and transfers the file to another server

    So there are two types of files i want to check if are coming through and if they did not come through in an hour send an email.

    so files test1_* and test2_* I am checking for.

    Could somebody help me out with the logic.

    The logic i am thinking is for the perl script
    if test1_* or test2_* create date < time on server
    then files are send ing within an hour
    else files are not sending through

    when 1 hour reaches and no files were sent in an hour send an email.


    Could somebody help me out and let me know where i am going wrong withthe logic please.
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    you would have to check if the creation date was within the last hour, not if it was just less than the server time.

    if (creation date < server time and creation date > server time - 1 hour)

    if you are using perls time() function

    Code:
    $time = time;
    if ($blah < $time && $blah > $time-3600)
    where $blah is the file creation time in epoch seconds

    Comment

    Working...