Hello everyone,

I created this simple script as a temporary remedy for IIS.  It seems to
be going down once a day.  We're waiting on new hardware which will be
running LAMP instead.  In the mean time this Perl script below was
created to check the services and bring them up if they are not running.
I am new to programming, Perl, and Mechanize.  For some strange reason
when the "while" test is done it sees the site down and runs the batch
script to restart the server.  This script is cycling the IIS server
every two minutes. Can anyone explain what I am missing?  It seemed
pretty straight forward to me.


#!/usr/local/bin/perl

use WWW::Mechanize;
use diagnostics;
use strict;

my $mech = WWW::Mechanize->new( autocheck => 0);

# IP is being used because there are to mirrored
# servers using the same hostname and load balanced.
#

my $url = "http://my_server_ip_here";;
my $trick = 0;

while ($trick == 0) {
        $mech->get( $url );

        if ($mech->success){
                ;
        }

        else {
                system "c:\\my.bat";
        }

        sleep 120;
}


Javier Prats
Technical Project Coordinator
Taylor & Francis Group, LLC
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487



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


Reply via email to