Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. use Proc::Background;
  2.  
  3. my @commands = (
  4. ['./Files1.exe ALL'],
  5. ['./Files2.exe ALL'],
  6. ['./Files3.exe ALL'],
  7. ['./Files4.exe ALL'],
  8. );
  9.  
  10. my @procs = map { Proc::Background->new(@$_) } @commands;
  11.  
  12. $_->wait for @procs;
  13.  
  14. system 'echo', 'CSCProc', '--pidsAndExitStatus', map { $_->pid, $_->wait } @procs;
  15.  
  16. `mergefiles.exe`;
  17.  
  18. my @scripts = qw(... commands ...);
  19. my @jobs = ();
  20. foreach my $script (@scripts) {
  21. my $job = threads->create( sub {
  22. system($script);
  23. });
  24. push @jobs, $job;
  25. }
  26.  
  27. $_->join() foreach @jobs;
  28.  
  29. #!/usr/bin/perl
  30. use strict; use warnings; use threads;
  31.  
  32. my @scripts = (
  33. q(echo "script 1 reporting"),
  34. q(perl -e "sleep 2; print qq{hi there! This is script 2 reportingn}"),
  35. q(echo "script 3 reporting"),
  36. );
  37.  
  38. my @jobs = map {
  39. threads->create(sub{
  40. system($_);
  41. });
  42. } @scripts;
  43.  
  44. $_->join foreach @jobs;
  45.  
  46. print "finished all my jobsn";
  47.  
  48. system q(echo "This is the last job");
  49.  
  50. C:...>perl stackoverflow.pl
  51.  
  52. "script 1 reporting"
  53. "script 3 reporting"
  54. hi there! This is script 2 reporting
  55. finished all my jobs
  56. "This is the last job"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement