added MySQL keepalive to DBI-version of AST_manager_listen.pl

git-svn-id: svn://192.168.202.10@91 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-07-20 15:49:40 +00:00
parent daaee3a272
commit 1600dbdf66
@@ -35,6 +35,7 @@
# 51222-1553 - fixed parentheses bug in manager output
# 60403-1230 - Added SVN/1.4 support for different output
# 60718-0909 - changed to DBI by Marin Blu
# 60720-1142 - added keepalive to MySQL connection every 50 seconds
#
# constants
@@ -137,7 +138,7 @@ while ($sthArows > $rec_count)
if ($DBext_context) {$ext_context = $DBext_context;}
$rec_count++;
}
$sthA->finish();
$sthA->finish();
if (!$telnet_port) {$telnet_port = '5038';}
@@ -475,15 +476,25 @@ while($one_day_interval > 0)
}
### run a keepalive command to flush whatever is in the buffer through and to keep the connection alive
### Also, keep the MySQL connection alive by selecting the server_updater time for this server
if ($endless_loop =~ /00$|50$/)
{
&get_time_now;
### Grab Server values to keep DB connection alive
$stmtA = "SELECT last_update FROM server_updater where server_ip = '$server_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@aryA = $sthA->fetchrow_array;
$last_update = "$aryA[0]";
$sthA->finish();
@list_lines = $tn->cmd(String => "Action: Command\nCommand: show uptime\n\n", Prompt => '/--END COMMAND--.*/', Errmode => Return, Timeout => 1);
if($DB){print "input lines: $#list_lines\n";}
if($DB){print "+++++++++++++++++++++++++++++++sending keepalive transmit line $endless_loop|$now_date|\n";}
if($DB){print "+++++++++++++++++++++++++++++++sending keepalive transmit line $endless_loop|$now_date|$last_update|\n";}
$keepalive_count_loop=0;
}