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 $outfile = '/moira/dcm/ca.out';
13 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
16 # First, let's do people with NFS homedirs, since it's not hard.
17 $sth = $dbh->prepare("SELECT n.nfsphys_id, n.dir, m.name ".
18 "FROM nfsphys n, machine m ".
19 "WHERE m.mach_id = n.mach_id ".
20 "ORDER BY n.nfsphys_id") || exit $MR_DBMS_ERR;
22 $sth->execute || exit $MR_DBMS_ERR;
25 open(OUT, ">$outfile") || exit $MR_OCONFIG;
27 while (($id, $dir, $machname) = $sth->fetchrow_array) {
29 $foo = $dbh->prepare("SELECT u.login, u.fullname ".
30 "FROM users u, filesys f ".
31 "WHERE f.label = u.login AND u.status = 1 ".
32 "AND f.phys_id = " . $dbh->quote($id));
34 $foo->execute || exit $MR_DBMS_ERR;
35 while (($login, $fullname) = $foo->fetchrow_array) {
38 $row = "*$machname:$dir\n";
42 $row = "$login,$fullname\n";
48 #Now, let's do all the AFS homedirs. This will take a while longer.
49 $sth = $dbh->prepare("SELECT UNIQUE u.login, u.fullname, f.name ".
50 "FROM users u, filesys f ".
51 "WHERE f.label = u.login AND u.status = 1 ".
52 "AND f.type = 'AFS' ".
53 "ORDER BY u.login") || exit $MR_DBMS_ERR;
55 $sth->execute || exit $MR_DBMS_ERR;
58 while (($login, $name, $dir) = $sth->fetchrow_array) {
63 $row = "*AFS:$path\n";
67 $row = "$login,$name\n";