source: locker/sbin/parallel-find.pl @ 722

Last change on this file since 722 was 722, checked in by price, 15 years ago
import sec-tools scripts Two of these are obsolete, named with .old in /mit/scripts/sec-tools; I'm going to remove them in the next commit. But they'll be in the svn history here, which is better than lying around with .old names.
  • Property svn:executable set to *
File size: 982 bytes
Line 
1#!/usr/bin/perl
2
3# Script to help generate find the .scripts-version files
4
5use lib '/mit/scripts/sec-tools/perl';
6
7open(FILE, "</mit/scripts/sec-tools/store/scriptslist");
8my $dump = "/mit/scripts/sec-tools/store/versions";
9
10die if (-e $dump);
11`mkdir $dump`;
12
13use Proc::Queue size => 40, debug => 0;
14use POSIX ":sys_wait_h"; # imports WNOHANG
15
16# this loop creates new childs, but Proc::Queue makes it wait every
17# time the limit (50) is reached until enough childs exit
18
19# Note that we miss things where one volume is inside another if we
20# use -xdev.  May miss libraries stuff.
21
22while (<FILE>) {
23    my ($user, $homedir) = /^([^ ]*) (.*)$/;
24    my $f=fork;
25    if(defined ($f) and $f==0) {
26        print "$user\n";
27#       print "find /mit/$user/web_scripts -name .scripts-version -fprint $dump/$user 2> /dev/null";
28        `find $homedir/web_scripts -xdev -name .scripts-version -fprint  $dump/$user 2> /dev/null`;
29        sleep rand 1;
30        exit(0);
31    }
32    1 while waitpid(-1, WNOHANG)>0; # reaps childs
33}
Note: See TracBrowser for help on using the repository browser.