#------------------------------------------------------------------------- # Check for the existence of the directories requested by the user. #------------------------------------------------------------------------- # sub YCHECK { my ($user, $sid, $oraserv, $site, @dates) = @_; my ($server, $path, $ytmp, $datdir, $fullpath, $tmpfull, $what, $what2); my @vdates = (); my %paths = (); my %tmps = (); my $njobs = 0; my $maxnjobs = 10; if (($site =~ "l",) || ($site =~ "c") || ($site =~ "n") || ($site =~ "w")) { $site = "l"; $server = "yos.$site.com"; $path = "/people/$user/$oraserv/$sid/arch/"; $ytmp = "/tmp/$oraserv/$sid/"; } elsif ($site =~ /wf/) { $server = "yos.$site.com"; $path = "/people/$user/$oraserv/$sid/arch/"; $ytmp = "/tmp/$oraserv/$sid/"; } elsif ($site =~ "h") { $server = "yos.$site.com"; $path = "/people/$user/$oraserv/$sid/arch/"; $ytmp = "/tmp/$oraserv/$sid/"; } else { die "$site is not a valid site for this script please contact "; } foreach $datdir (@dates) { $fullpath = (join ('', $path, $datdir)); $fulltmp = (join ('', $ytmp, $datdir)); my $pid = fork(); if ($pid == 0) { $what = `rsh $server ls -ld $fullpath`; if ($what =~/\S/) { $what2 = `rsh $server mkdir -p $fulltmp`; if ($what2 !~/\S/) { exit 1; } } exit 0; } $paths{$pid} = $fullpath; $njobs++; while ($njobs >= $maxnjobs) { $waitpid = wait(); if ($?) { push(@vdates, $paths{$waitpid}); } $njobs--; } } while ($njobs > 0) { $waitpid = wait(); if ($?) { push(@vdates, $paths{$waitpid}); } $njobs--; } my @sorteddates = sort(@vdates); return(@sorteddates); }