This repository has been archived on 2025-02-12. You can view files and clone it, but cannot push or open issues or pull requests.
CLF/log.d/bin/listconfigs
2004-09-10 11:31:11 +00:00

33 lines
762 B
Perl
Executable file

#!/usr/bin/perl
#
#
use DBI;
$configfile = "/etc/log.d/db.conf";
eval('require("$configfile")');
die "*** Failed to eval() file $configfile:\n$@\n" if ($@);
my $dbh = DBI->connect($DBI, $user, $password) or die DBI::errstr;
my $sth = $dbh->prepare("select tpremadetype_desc from syslog_tpremadetype")
or die "Can't prepare statement: $DBI::errstr";
my $rc = $sth->execute
or die "Can't execute statement: $DBI::errstr";
if (!$sth->rows) {
print "Error: no systems defined\n";
exit (99);
}
print "System identifiers:\n";
print "===================\n";
while (($system) = $sth->fetchrow_array) {
if ($system) {
print "$system\n";
}
}
# check for problems which may have terminated the fetch early
die $sth->errstr if $sth->err;
$dbh->disconnect();