There's more than one way to do things | |
PerlMonks |
Module Net-Pingby Kozz (Friar) |
on Sep 23, 2002 at 16:49 UTC ( [id://200159]=perlquestion: print w/replies, xml ) | Need Help?? |
Kozz has asked for the wisdom of the Perl Monks concerning the following question:
Most esteemed monks:
I wanted to write a sort of "wrapper" script for my crontab that calls fetchmail to ping an external host before attempting to fetch the mail, since my cable network connectivity can often be quite flaky. When it's unreachable, my mailbox fills up with fetchmail error messages.
So I decided to use the Net::Ping module, but it's not quite working as expected.
I wrote this simple script to test things:
Then within the if/else construct I would place an exec() call (to fetchmail with the desired parameters once I knew the ping portion was working correctly. However, when putting the external hostname in $hostname, it always returns "unreachable", yet I can still use /bin/ping to reach it just fine. So I tried for a $hostname also 'localhost', '127.0.0.1', and also the local interface's IP address, '10.0.0.1'. But they also all return unreachable. What am I doing wrong? It must be something quite simple... Thank you for your consideration. --Kozz
Back to
Seekers of Perl Wisdom
|
|