I think what you want is
#!/usr/bin/perl
use strict;
use warnings;
$SIG{CHLD} = sub {wait ()}; #wait to avoid zombies
my $pid = fork ();
die "cannot fork: $!" unless defined($pid);
if ($pid == 0) {
#do some perl stuff
}
elsif($pid < 0) {
#do some other perl stuff
exit(0);
}
waitpid($pid,0);
Daryl J. Hoyt
Software Engineer
Geodesic Systems
312-832-2010
< http://www.geodesic.com>
< mailto:djh@;geodesic.com>
-----Original Message-----
From: chad kellerman [mailto:ckellerman@;alabanza.com]
Sent: Wednesday, November 13, 2002 2:32 PM
To: [EMAIL PROTECTED]
Subject: fork?
Hey guys,
I maybe misunderstanding what a fork can do, so I thought I would
write in to verify. Because it doesn't appear to be doing what I want
(think it should).
I have a script that tars (unix) directories. I want the script to tar
directories [a-n] as it is tarrring up [a-n] I want it to tar [o-z]. At
the same time. So that two tars would be running st the same time.
what I did was
#!/usr/bin/perl
use strict;
use warnings;
$SIG{CHLD} = sub {wait ()}; #wait to avoid zombies
my $pid = fork ();
die "cannot fork: $!" unless defined($pid);
if ($pid == 0) {
#do some perl stuff
}
exit(0);
}
waitpid($pid,0);
#do some other perl stuff while above is running.
I want the perl script to "multi task".
Am I missing something??
thanks,
Chad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]