Can someone assist me in modifying the the script below to support the
following:

1)define proxy server
2)the URL being accessed via LWP is protected, so I need to specify
username/passwd combo

Thanks in advance,

Script:
#!/usr/local/bin/perl
 # script: webLazarus

 use LWP::Simple;
 use constant URL       => 'http://presto.capricorn.com/';
 use constant APACHECTL => '/usr/local/apache/bin/apachectl';
 $MAIL                  =  '/usr/sbin/sendmail';
 $MAIL_FLAGS            =  '-t -oi';
 $WEBMASTER             =  '[EMAIL PROTECTED]';

 head(URL) || resurrect();

 sub resurrect {
     open (STDOUT,"| $MAIL $MAIL_FLAGS") || die "mail: $!";
     select STDOUT; $| = 1;
     open (STDERR,">&STDOUT");

     my $date = localtime();
     print <<END;
 To: $WEBMASTER
 From: The Watchful Web Server Monitor <nobody>
 Subject: Web server is down

 I tried to call the Web server at $date but there was
 no answer.  I am going to try to resurrect it now:

 Mumble, mumble, mumble, shazzzzammmm!

 END
     ;

     system APACHECTL,'restart';

     print <<END;

 That's the best I could do.  Hope it helped.

 Worshipfully yours,

 The Web Monitor
 END
     close STDERR;
     close STDOUT;
 }


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to