changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[livejournal] r17893: add time and tz to output line

Committer: ldoolan
add time and tz to output line
U   trunk/bin/dbcheck.pl
Modified: trunk/bin/dbcheck.pl
===================================================================
--- trunk/bin/dbcheck.pl	2010-12-09 16:07:44 UTC (rev 17892)
+++ trunk/bin/dbcheck.pl	2010-12-09 16:37:52 UTC (rev 17893)
@@ -150,10 +150,16 @@
         return 0;
     }
 
-    my $tzone;
-    #(undef, $tzone) = $db->selectrow_array("show variables like 'timezone'");
+    my ($tzone, $dtg);
+    (undef, $tzone) = $db->selectrow_array("show variables like 'time_zone'");
+    if (lc($tzone) eq 'system') {
+        (undef, $tzone) = $db->selectrow_array("show variables like 'system_time_zone'");
+    }
     $tzone ||= "???";
 
+    ($dtg)= $db->selectrow_array("select date_format(now(), '%H:%i')");
+    $dtg ||= 'xxx xxxxxxxxx hh:mm:ss';
+
     $sth = $db->prepare("SHOW PROCESSLIST");
     $sth->execute;
     my $pcount_total = 0;
@@ -219,7 +225,7 @@
     }
 
     #print "$dbid of $d->{masterid}: $d->{name} ($roles)\n";
-    printf("%4d %-18s %4s repl:%7s %4s conn:%4d/%4d  $tzone \%s ($roles)\n",
+    printf("%4d %-18s %4s repl:%7s %4s conn:%4d/%4d  $dtg $tzone \%s ($roles)\n",
            $dbid,
            $d->{name},
            $d->{masterid} ? $d->{masterid} : "",

Tags: changelog_bot, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments