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

Revision 25455, 960 bytes checked in by jdreed, 12 years ago (diff)
In moira: * Re-snapshot moira at r4073 to pick up new changes to clients; the eunice issue described in the previous entry is no longer relevant
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2# $Id: spwatch.gen 4051 2011-09-08 18:46:37Z zacheiss $
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 AND (p.status = 1 OR p.status = 2 OR p.status = 4) AND m.status != 3 " .
19                     "ORDER BY m.name") || exit $MR_DBMS_ERR;
20
21$sth->execute || exit $MR_DBMS_ERR;
22
23umask 022;
24open(OUT, ">$outfile") || exit $MR_OCONFIG;
25print OUT "# This File is automatically generated by Moira.  Do not edit.\n";
26
27while (($hostname) = $sth->fetchrow_array) {
28    next if $hostname eq "[NONE]";
29    $row = "$hostname\n";
30    $row =~ s/\0//g;
31    print OUT $row;
32}
33
34close OUT;
35exit 0;
Note: See TracBrowser for help on using the repository browser.