tbrehm
2010-05-20 d65d4f57d58749da096fe5097853746975cdeb6c
Added better error handling to vlogger script in case that the mysql database connection is not available.
1 files modified
10 ■■■■■ changed files
server/scripts/vlogger 10 ●●●●● patch | view | raw | blame | history
server/scripts/vlogger
@@ -252,9 +252,14 @@
    }
    # test the connection
    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,6 +508,7 @@
# sub to update the database with the tracker data
sub dump_tracker {
    eval {
    if ( keys(%tracker) > 0 ) {
        my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS )
          or warn "DBI Error: $!";
@@ -529,6 +535,10 @@
        %tracker = ();
    }
    alarm $DBI_DUMP;
    };
    if ($@) {
        print "Unable to store vlogger data in database\n";
    }
}
# print usage info