Changeset 729 for locker


Ignore:
Timestamp:
Apr 13, 2008, 9:29:06 PM (17 years ago)
Author:
price
Message:
more perl, less shell (for future enhancements)

Temporarily I'm also ignoring stuff in e.g. the sipb cell, because for
an undiagnosed reason those finds are hanging for me with my root tokens.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/sbin/parallel-find.pl

    r724 r729  
    1111system("mkdir", $dump) && die;
    1212
    13 use Proc::Queue size => 40, debug => 0;
     13use Proc::Queue size => 40, debug => 0, trace => 0;
    1414use POSIX ":sys_wait_h"; # imports WNOHANG
    1515
     
    2020# use -xdev.  May miss libraries stuff.
    2121
     22sub find ($$) {
     23    my $user = shift;
     24    my $homedir = shift;
     25
     26    open my $files, "find $homedir/web_scripts -xdev -name .scripts-version 2>/dev/null |";
     27    open my $out, ">$dump/$user";
     28    while (my $f = <$files>) {
     29        print $out $f;
     30    }
     31    return 0;
     32}
     33
    2234while (<FILE>) {
    2335    my ($user, $homedir) = /^([^ ]*) (.*)$/;
    2436    my $f=fork;
    2537    if(defined ($f) and $f==0) {
     38        if ($homedir !~ m|^/afs/athena|) {
     39            print "ignoring non-athena-cell $user $homedir\n";
     40            exit(0);
     41        }
    2642        print "$user\n";
    27         my $ret = system("find $homedir/web_scripts -xdev -name .scripts-version -print > $dump/$user 2> /dev/null");
     43        $ret = find($user, $homedir);
    2844        sleep rand 1;
    2945        exit($ret);
    3046    }
    31     while (waitpid(-1, WNOHANG)>0) {
    32         $? && die "child exited with error: $?";
    33     }; # reaps childs
     47    1 while waitpid(-1, WNOHANG)>0; # avoids memory leaks in Proc::Queue
    3448}
Note: See TracChangeset for help on using the changeset viewer.