Developer
Developer

Reputation: 6350

Run multiple instances of a Perl script

I have a Perl script which does some text processing. Now I want to run multiple instances of that script.

I tried to use the Parallel::ForkManager module to achieve this, but that module is not available on my server and I can't install it.

Is there any way to do this using Perl or shell script in the Unix environment.

Upvotes: 0

Views: 419

Answers (2)

sticky bit
sticky bit

Reputation: 37472

Is using fork() possible? Then just do it the hard way and fork() in the program itself as you like. Or maybe write a wrapper in a pattern of fork();exec(); or system(); if you need any output.

Upvotes: 1

Abhijit Pritam Dutta
Abhijit Pritam Dutta

Reputation: 5581

In shell scripting you can do it so easily like below:-

your_perl_script.pl &
your_perl_script.pl &
your_perl_script.pl &
wait

Here total 3 instances of your Perl script will run parallel. If you want more just add more like above.

Upvotes: 1

Related Questions