I have two scripts script_a and script_b. script_a calls script_b. script_b forks two processes. As shown below.
script_a waits for both the parent and child of script_b
`` backticks in perl wait for the command to complete. So if you don't want parent process to wait put in sytem(command &) in background.
Instead of using `` in script_a. We have redirected the STDOUT and STDERR in script_a. Something like
script_a
system("script_b.pl > /var/tmp/out_file 2>&1");
script_b
#! /usr/local/bin/perl
$f_id = fork();
if (! $f_id) {
exec("sleep 10; echo 'i am child'");
}
if ($f_id) {
print "i am parent\n";
}
This way the caller didnot wait for the child in exec to complete.
Thanks for the help here.