in reply to Problem Searching an array for a string... Please Help!
use strict; use warnings; use LWP::Simple; use POSIX qw(strftime); my $address = $ARGV[0] or die "No address!"; # Create Router Re-Configuration script run command my $rtr_cfg="wscript.exe rtr-telnet.vbs"; # Create a var that holds the html and fill it my $html = get($address) || ""; # Create a Log File open (fail_log,">>faillog.txt"); if ( $html =~ /<\/html>/) { print fail_log strftime("%c - $address is up\n", localtime); } else { print fail_log strftime("%c - $address is down\n", localtime); system ($rtr_cfg); }
$ perl checksite.pl http://www.perlmonks.org
|
|---|