I use this to see if my Outlook Web Access server is still up. Been having some problems with the asp engine on IIS dying mysteriously, the http service is available, but doesn't render the page correctly, so I check the <title> tag.
use LWP::Simple; $blat_path = "blat.exe "; $subject = " OWA "; $recipients = " bwilson\@networkservices.net "; $message = " owa.txt "; $doc = get 'http://webmail.networkservices.net/exchange/logon.asp'; $now_string = localtime; $file = "c:\\scripts\\cron.txt"; open (CRON, ">>$file"); print CRON "$now_string cron ran.\n"; close(CRON); unless ($doc =~ /<TITLE>Microsoft Outlook Web Access - Logon<\/TITLE>/) { $commandline = $blat_path; $commandline .= $message; $commandline .= "-s \"$subject\" " if $subject; $commandline .= "-t \"$recipients\" " if $recipients; system($commandline); system("c:\\scripts\\www.pl"); } I know it's ugly, I'm still learning :) no luck getting this to run as a service though.. Ben -----Original Message----- From: Edward G. Orton [mailto:[EMAIL PROTECTED]] Sent: Monday, January 21, 2002 2:26 PM To: Chris; Win32 Perl Users Subject: Re: Quick PING question ----- Original Message ----- From: "Chris" <[EMAIL PROTECTED]> To: "Win32 Perl Users" <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 2:08 PM Subject: RE: Quick PING question > Thank you to ALL who answered.... > > Here I was trying to reinvent the wheel! ;-) > > Ok, here's another one for you... Can I, from command line > run a "hit" to a web site, and report the results back to a file, > and NOT to the browser? > > It seems that the PING thing saved so much typing that they want > me to try to do the same for some Web Sites. > > The results would NOT be a complete web page, but like a 404 type error, > and capture that out put, or (as one site has) a simple "You made it!" > text... > > If not, I have a lot of web sites I have to hit to verify that they are > still up.. > > These are internal for a place I work at, and they are looking for sites > that > we should not be able to hit (a 404) or give the site test page ("You > made it!") > > Unfortunately, the "You made it!" is not static, and I can get one of > about 500 > different results, but all within one to five lines. > > TIA! > > Chris You could try: #!/usr/bin/perl -w use strict; use LWP::Simple; $url = 'http://www.yoursite.com'; #change if (get($url)) { print "$url is available\n"; } else { print "$url is not available\n"; } If you want timing, then you can use Time::Hires to find out how long it took to get the results. ego Edward G. Orton, GWN Consultants Inc. Phone: 613-764-3186, Fax: 613-764-1721 email: [EMAIL PROTECTED] _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users