]> andersk Git - moira.git/blame - gen/spwatch.gen
Update illegal characters and log something when one is found.
[moira.git] / gen / spwatch.gen
CommitLineData
6d1a7b25 1#!/moira/bin/perl -Tw
2# $Id$
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
26ef7fce 16$sth = $dbh->prepare("SELECT m.name FROM printers p, ".
6d1a7b25 17 "machine m WHERE p.type = 'SAP' AND p.mach_id = ".
26ef7fce 18 "m.mach_id ORDER BY m.name") || exit $MR_DBMS_ERR;
6d1a7b25 19
20$sth->execute || exit $MR_DBMS_ERR;
21
22umask 022;
23open(OUT, ">$outfile") || exit $MR_OCONFIG;
26ef7fce 24print OUT "# This File is automatically generated by Moira. Do not edit.\n";
6d1a7b25 25
26ef7fce 26while (($hostname) = $sth->fetchrow_array) {
6d1a7b25 27 next if $hostname eq "[NONE]";
26ef7fce 28 $row = "$hostname\n";
6d1a7b25 29 $row =~ s/\0//g;
30 print OUT $row;
31}
32
33close OUT;
34exit 0;
This page took 0.062848 seconds and 5 git commands to generate.