ftimme
2012-05-30 2cb1563f63386b35a69e460051aa9b4a2851d104
server/scripts/vlogger
@@ -28,6 +28,7 @@
# 1.1   bugfix release
# 1.2   support for mod_logio
# 1.3   various contributed bugfixes
# 1.3ISPconfig1 This local version has been modified for ISPConfig. Namely: "Added better error handling to vlogger script in case the MySQL database connection is not available."
#
# TODO:
@@ -252,9 +253,14 @@
    }
    # test the connection
    my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS )
      or die "DBI Error: $!";
    $dbh->disconnect;
   eval {
      my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS )
        or die "DBI Error: $!";
      $dbh->disconnect;
   };
   if ($@) {
       print "MySQL Connection problem\n";
    }
    # SIGALRM dumps the tracker hash
    $SIG{ALRM} = \&dump_tracker;
@@ -503,7 +509,8 @@
# sub to update the database with the tracker data
sub dump_tracker {
    if ( keys(%tracker) > 0 ) {
    eval {
   if ( keys(%tracker) > 0 ) {
        my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS )
          or warn "DBI Error: $!";
        foreach my $key ( keys(%tracker) ) {
@@ -529,6 +536,10 @@
        %tracker = ();
    }
    alarm $DBI_DUMP;
   };
    if ($@) {
        print "Unable to store vlogger data in database\n";
    }
}
# print usage info