5 # The following exit codes are defined and MUST BE CONSISTENT with the
6 # error codes the library uses:
7 $MR_DBMS_ERR = 47836421;
10 $outfile = '/moira/dcm/mailhosts.out';
14 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
17 $sth = $dbh->prepare("SELECT f.label, m.name ".
18 "FROM filesys f, machine m, nfsphys p, serverhosts s ".
19 "WHERE s.service='POSTOFFICE' AND s.mach_id=f.mach_id ".
20 "AND f.mach_id=m.mach_id AND f.type='IMAP' ".
21 "AND f.createflg!=0 AND f.mach_id=p.mach_id ".
22 "AND f.phys_id=p.nfsphys_id ".
25 $sth->execute || exit $MR_DBMS_ERR;
29 open(OUT, ">$outfile") || exit $MR_OCONFIG;
31 print OUT "; MIT Network Host Table\n;\n";
32 print OUT "; \t\$" . "Author:" . " \$\n";
33 print OUT "; \t\$" . "Date:" . " \$\n";
34 print OUT "; \t\$" . "Revision:" . " \$\n";
35 print OUT "; Host table generated by Moira at $tnow\n;\n";
37 while (($label, $name) = $sth->fetchrow_array) {
39 $label =~ tr/a-z/A-Z/;
42 if (16 - length($label) > 8) {
48 $row = "$label$sp\tIN\tCNAME\t$name.\n";