It prints out Process complete, and the script runs fine but I keep getting this error:sub run_program { my $inputfile; my $cmdline; my @running; my $tot_running; my $tot_files; my $tot_done; my $segment; my $locdir; $step++; # step 1 run input command print STDOUT "Running input command $in_cmnd\n"; system ("$in_cmnd"); print STDOUT "Running Script\n"; $step++; # Run as child process so can still use window????? unless(fork) { JOBS: for(;;) { @running=glob("$base/running.$pid.???"); $tot_running=@running+0; $tot_files=0; $tot_done=0; JOB: foreach $inputfile (glob("$in_dsn.???")) { $tot_files++; $segment=substr($inputfile,-3); # it's done if (open CHECK, "$base/done.$pid.$segment") { unlink "$base/running.$pid.$segment"; unlink "$base/done.$pid.$segment"; unlink "$inputfile"; $tot_done++; close CHECK; next JOB; } if (open ERROR, "$base/error.$pid.$segment") { system("rm $base/running.$pid.$segment 2> /dev/null"); print STDOUT "There was an error running segment $segme +nt\n"; error_message("There was an error running segment $segm +ent\n"); $tot_done++; close ERROR; next JOB; } if (open RUNNING, "$base/running.$pid.$segment") { next JOB; close RUNNING; } # launch the process if ($tot_running < $num_process) { $locdir = "/\U$mnem/$pid/$segment"; system("mkdir -p $locdir"); $cmdline="cd $locdir ;nohup $script $pid.$segment $pid. +$segment \L$filter\E 01 $no_mnths N >stdout 2>stderr &"; print STDOUT "Running\n$cmdline\n"; system("$cmdline"); system("echo xxx > $base/running.$pid.$segment"); $tot_running++; } } # for each file # break out of the loop when all files are processed last JOBS if $tot_done == $tot_files; sleep(10); } $step++; # step 3, run output command print STDOUT "Running $out_cmnd\n"; system("$out_cmnd"); $step++; # step 4, merge reports print STDOUT "Mergeing reports\n"; &merge_forms; print STDOUT "\nProcess complete\n\n"; } # end of fork }
I believe it has something to do with the fork but not quite sure, any ideas!!!! Thanks, TomProcess complete X Error of failed request: BadIDChoice (invalid resource ID chosen fo +r this connection) Major opcode of failed request: 53 (X_CreatePixmap) Resource id in failed request: 0x100004f Serial number of failed request: 25739 Current serial number in output stream: 24474
In reply to Running multiple scripts using fork by enanrum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |