perl ?

just quickly throwing something together - this is untested.


$done = 0;
$count = 0;
while ($done) {

    $dbh->do("analyze table t1");
    my $info = $dbh->{mysql_info};      
    if ($info =~ /some kind of error message/) {
        $dbh->do("repair table t1");
        my $info2 = $dbh->{mysql_info}; 
          if ($info2 =~ /another error message/) {
           print "Error while repairing table t1\n";
           last;
         }
    } else {
       $done = 1;
    } 

    $count++;
    if ($count > 5) {
       print "unable to repair errors in 5 passes\n";
       last;
    }
}



You would have to figure what kind of errors may come back and put those
in the if conditions



-----Original Message-----
From: Ravi Kumar [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 01, 2006 2:56 PM
To: Sergei Golubchik; Robert DiFalco
Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Script run how???

Hi,
   
  I want to run following command thru script .
  analyze table t1;
  optimize table t1;
  analyze table t2;
  optimize table t2;
   
  Can I do it on linux mysql ?
  I also want to run script like during analysing if we notice any error
related with table then run repair table t1 l repair table t2;
   
  Thanks,
   

                
---------------------------------
How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call
rates.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to