in reply to Sequential processing with fork.

What's going on here? Too much code! It's simpler than that :)

#!/usr/bin/perl # http://perlmonks.org/?node_id=1137416 use strict; use warnings; $| = 1; for my $i (1..33) { $i > 10 and warn("waiting...\n"), wait; fork or warn("client $i started\n"), sleep(60), die("client $i ended +\n"); sleep 5; } 1 while wait > 0; # reap the rest warn "all clients finished\n";

replace the "fork or warn..." with: fork or exec("yourprocess"), die "exec failed $!";

Replies are listed 'Best First'.
Re^2: Sequential processing with fork.
by Kelicula (Novice) on Aug 04, 2015 at 23:21 UTC

    Dood! That is exactly what I need and thanks for the tip about exec, I'm gonna make a working model and post results...

    ~~~~~~~~~ I'm unique, just like everybody else! ~~~~~~~~~