By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

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

P: 154
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.
May 7 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,059
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

Expand|Select|Wrap|Line Numbers
  1. $time = time;
  2. if ($blah < $time && $blah > $time-3600) 
where $blah is the file creation time in epoch seconds
May 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.