fmuquartet
Programmer
Please observer the script below that monitors my remote Apaches. I am having a problem modifying the script for two new authentication mechanism that were put in place.
1) I need to script to specify a proxy server (no userid or passwd required).
2) When prompt for authentication dialog box enter specific account information (userid/passwd combo).
Thanks in advance!
#!/usr/bin/perl
# script: monitor
use LWP::Simple;
use constant URL => '<A HREF="use constant APACHECTL => '/usr/sbin/apachectl';
$MAIL = '/usr/sbin/sendmail';
$MAIL_FLAGS = '-t -oi';
$WEBMASTER = 'mark@yahoo.com';
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 Global PRD 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:
One moment while I apply magic-pixie dust!
END
;
system APACHECTL,'restart';
print <<END;
That's the best I could do. Hope it helped.
Worshipfully yours,
The Apache Server
END
close STDERR;
close STDOUT;
}
1) I need to script to specify a proxy server (no userid or passwd required).
2) When prompt for authentication dialog box enter specific account information (userid/passwd combo).
Thanks in advance!
#!/usr/bin/perl
# script: monitor
use LWP::Simple;
use constant URL => '<A HREF="use constant APACHECTL => '/usr/sbin/apachectl';
$MAIL = '/usr/sbin/sendmail';
$MAIL_FLAGS = '-t -oi';
$WEBMASTER = 'mark@yahoo.com';
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 Global PRD 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:
One moment while I apply magic-pixie dust!
END
;
system APACHECTL,'restart';
print <<END;
That's the best I could do. Hope it helped.
Worshipfully yours,
The Apache Server
END
close STDERR;
close STDOUT;
}