source: trunk/third/moira/gen/spwatch.gen @ 23740

Revision 23740, 881 bytes checked in by broder, 16 years ago (diff)
In moira: * New CVS snapshot (Trac: #195) * Drop patches that have been incorporated upstream. * Update to build without krb4 on systems that no longer have it. This doesn't build yet on squeeze, which lacks a krb4 library, but I'm committing now before I start hacking away at a patch to fix that.
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2# $Id: spwatch.gen,v 1.2 2001-08-28 02:38:20 jweiss Exp $
3#
4# The following exit codes are defined and MUST BE CONSISTENT with the
5# error codes the library uses:
6$MR_DBMS_ERR = 47836421;
7$MR_OCONFIG = 47836460;
8
9$outfile = '/moira/dcm/spwatch.out';
10
11use DBI;
12
13$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
14    || exit $MR_DBMS_ERR;
15
16$sth = $dbh->prepare("SELECT m.name FROM printers p, ".
17                     "machine m WHERE p.type = 'SAP' AND p.mach_id = ".
18                     "m.mach_id ORDER BY m.name") || exit $MR_DBMS_ERR;
19
20$sth->execute || exit $MR_DBMS_ERR;
21
22umask 022;
23open(OUT, ">$outfile") || exit $MR_OCONFIG;
24print OUT "# This File is automatically generated by Moira.  Do not edit.\n";
25
26while (($hostname) = $sth->fetchrow_array) {
27    next if $hostname eq "[NONE]";
28    $row = "$hostname\n";
29    $row =~ s/\0//g;
30    print OUT $row;
31}
32
33close OUT;
34exit 0;
Note: See TracBrowser for help on using the repository browser.