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;
10 $ENV{PATH} = "/bin:/usr/bin:/sbin:/usr/sbin";
12 $outdir = '/moira/dcm/stellar';
13 $outfile = '/moira/dcm/stellar.out';
18 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
21 $sth0 = $dbh->prepare("SELECT l.list_id, m.name " .
22 "FROM list l, machine m, serverhosts sh " .
23 "WHERE sh.value3 = l.name AND sh.service = 'STELLAR' " .
24 "AND m.mach_id = sh.mach_id") || exit $MR_DBMS_ERR;
27 while (($root_list_id, $hostname) = $sth0->fetchrow_array) {
28 open(OUT, ">$outdir/$hostname");
30 $sth = $dbh->prepare("SELECT l.name FROM list l, imembers i " .
31 "WHERE i.list_id = " . $dbh->quote($root_list_id) .
32 "AND i.member_type = 'LIST' " .
33 "AND i.member_id = l.list_id " .
34 "ORDER BY l.name") || exit $MR_DBMS_ERR;
37 while (($name) = $sth->fetchrow_array) {
38 $sth2 = $dbh->prepare("SELECT UNIQUE i.member_type, i.member_id " .
39 "FROM imembers i, list l " .
40 "WHERE l.name = " . $dbh->quote($name) .
41 "AND i.list_id = l.list_id " .
42 "AND (i.member_type = 'USER' " .
43 "OR i.member_type = 'STRING')") ||
52 while (($type, $id) = $sth2->fetchrow_array) {
53 if ($type eq "USER") {
54 ($member) = $dbh->selectrow_array("SELECT login FROM users " .
58 $member = $member . "\@mit.edu";
60 elsif ($type eq "STRING") {
61 ($member) = $dbh->selectrow_array("SELECT string " .
63 "WHERE string_id = " .
67 $row = "$maybecomma$member";
80 system("cd $outdir && tar cf $outfile .") == 0 || exit $MR_OCONFIG;