Changeset 724


Ignore:
Timestamp:
Apr 9, 2008, 10:36:01 PM (14 years ago)
Author:
price
Message:
parallel-find.pl: work on Macs, and handle errors better

* in find, use -print and a redirect rather than -fprint, which doesn't
  exist in the Mac's find
* give a real error message when the directory exists, and die when we should
File:
1 edited

Legend:

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

    r722 r724  
    88my $dump = "/mit/scripts/sec-tools/store/versions";
    99
    10 die if (-e $dump);
    11 `mkdir $dump`;
     10(! -e $dump) || die "Output directory exists: $dump";
     11system("mkdir", $dump) && die;
    1212
    1313use Proc::Queue size => 40, debug => 0;
     
    2525    if(defined ($f) and $f==0) {
    2626        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`;
     27        my $ret = system("find $homedir/web_scripts -xdev -name .scripts-version -print > $dump/$user 2> /dev/null");
    2928        sleep rand 1;
    30         exit(0);
     29        exit($ret);
    3130    }
    32     1 while waitpid(-1, WNOHANG)>0; # reaps childs
     31    while (waitpid(-1, WNOHANG)>0) {
     32        $? && die "child exited with error: $?";
     33    }; # reaps childs
    3334}
Note: See TracChangeset for help on using the changeset viewer.