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

Revision 23740, 1.2 KB 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
3# $Id: longjobs.gen,v 1.1 2001-08-02 17:21:11 zacheiss Exp $
4
5# The following exit codes are defined and MUST BE CONSISTENT with the
6# error codes the library uses:
7$MR_DBMS_ERR = 47836421;
8$MR_OCONFIG = 47836460;
9
10$outfile = '/moira/dcm/longjobs.out';
11
12use DBI;
13
14$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
15  || exit $MR_DBMS_ERR;
16
17$sth = $dbh->prepare("SELECT name FROM list WHERE grouplist = 1")
18    || exit $MR_DBMS_ERR;
19
20$sth->execute || exit $MR_DBMS_ERR;
21
22umask 022;
23open(OUT, ">$outfile") || exit $MR_OCONFIG;
24
25while ($name = $sth->fetchrow_array) {
26   
27    $sth2 = $dbh->prepare("SELECT UNIQUE u.login FROM users u, imembers i, " .
28                          "list l WHERE l.name = " . $dbh->quote($name) .
29                          "AND l.list_id = i.list_id " .
30                          "AND i.member_type = 'USER' " .
31                          "AND i.member_id = u.users_id") || exit $MR_DBMS_ERR;
32
33    $sth2->execute || exit $MR_DBMS_ERR;
34                 
35    $row = "$name:";
36    $row =~ s/\0//g;
37    print OUT $row;
38    $maybecomma = "";
39
40    while ($member = $sth2->fetchrow_array) {
41        $row = "$maybecomma$member";
42        $row =~ s/\0//g;
43        print OUT $row;
44        $maybecomma = ",";
45    }
46
47    $row = "\n";
48    $row =~ s/\0//g;
49    print OUT $row;
50}
51
52close(OUT);
53$dbh->disconnect;
54
55exit 0;
Note: See TracBrowser for help on using the repository browser.