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

Revision 23178, 1.2 KB checked in by broder, 16 years ago (diff)
Take a new snapshot from CVS for Moira, and add a debathena-moira-update-server package
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2
3# $Id$
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.