|
|
| P is for Practical | |
| PerlMonks |
Trouble with Array or ??by Anonymous Monk |
| on Nov 07, 2011 at 03:40 UTC ( #936394=perlquestion: print w/ replies, xml ) | Need Help?? |
|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Hello, I am new to Perl and have spent about 15 hours (mostly on google, tutorials and bought a Perl book) trying to figure out what I assumed was a simple thing to do. I have 3 files: host.file - which has IP addresses and possibly hostnames email.file - which is an output file that is updated when I am emailed about a failed ping. output.file - basically just used for debugging/logging What I am trying to do is ping a list of hosts/IPs then email myself if the ping fails. So far I can get all of that to work. I run the script like every 5 minutes. The 'problem' is that I do not want it to email me every 5 minutes when it detects a failure, I would like it to add that IP to a list (email.file) then notice that I just emailed it and skip over it a few times, maybe for 60 minutes or something before it clears from the list and is available to be emailed again when the ping fails. I hope that makes sense. In the code I commented out my failed attempts, and removed most of the Net::SMTP stuff just to clean up the code. The trouble area I assume is around the while (@efile = <eFILE>) { area. Sorry about the sloppy code, I am new to coding, thanks, Sam.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||