Executing System Program

Greg Meckes <[email protected]> Tue, 18 Dec 2007 17:59:43 -0800 (PST)
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Greetings, I have the following task:

I have to run a Perl script to run spawn multiple processes on a Linux server. The issue is that
each process is huge and may take a while to run.

I simply want my program to run, then start process 1 and let it run in the background, then
immediately start process 2 etc.

Example: let's say I want to tar several directories, and each is 5 GB in size. I would like
program to run and spawn separate tar processes for each and NOT sit there and wait for each one
to finish before it goes to the next.

I have tried system, but it runs and waits and returns the output to the screen. Exec sits there
and waits too.

Right now I run through a loop and on each iteration I do:
tar -xvf foo.tar
chdir($dir);
    my @args = ("tar -cvf $File");
    system(@args) == 0 or die "system @args failed: $?";



-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]