Thanks, this is something I can play with too. TimH
On Sat, 14 Dec 2002 00:50:04 -0800 Jacob Meuser <[EMAIL PROTECTED]> wrote: > On Fri, Dec 13, 2002 at 04:04:25PM -0800, Bob Miller wrote: > > I made small changes, because he was wanting to test for a timeout, > not any ol' error. > > > #!/usr/bin/perl > > > > use strict; > > use LWP::UserAgent; > use HTTP::Status; > > > > sub check() { > > my $ua = LWP::UserAgent->new(timeout => 5); > > my $response = $ua->get('http://www.example.com/'); > if ($response == RC_REQUEST_TIMEOUT) { > > system("apachectl restart"); > > } > > } > > > > while (1) { > > check; > > sleep 60; > > } > > If you want to restart on any server error (you probably don't want to > restart on client errors): > > #!/usr/bin/perl -w > > use LWP::Simple; > use HTTP::Status(is_server_error); > use strict; > > my $rc = getstore("http://localhost/index.html", "/dev/null"); > > if (is_server_error($rc)) { > system("apachectl stop") == 0 > or die "Could not stop httpd: $?"; > sleep 10; > system("apachectl start") == 0 > or die "Could not start httpd: $?"; > } > > exit(0); > > HTTP::Status is part of perl libwww. > > -- > <[EMAIL PROTECTED]> > > How does that go ... _always_ check return codes? > _______________________________________________ > Eug-LUG mailing list > [EMAIL PROTECTED] > http://mailman.efn.org/cgi-bin/listinfo/eug-lug _______________________________________________ Eug-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug