convenientstore has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; print "PID=$$\n"; my $child = fork(); die "Can't fork: $!" unless defined $child; sub si { my $ar = shift; print "ar is $ar\n"; } if ( $child > '0' ) { #parent process print "Parent process: PID=$$, chid=$child\n"; system("/root/program/parent_pro.pl"); } else { #child process my $ppid = getppid(); print "Child process: PID=$$, parent=$ppid\n"; #system("echo this is child"); exec("/root/program/child_pro.pl"); } print "hi how are you\n"; print "fine i am doing good\n"; si("MJ"); si("JP");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using system and exec in same script using child
by ikegami (Patriarch) on Jan 11, 2010 at 06:09 UTC | |
by cdarke (Prior) on Jan 11, 2010 at 10:59 UTC | |
by convenientstore (Pilgrim) on Jan 11, 2010 at 22:33 UTC | |
by BrowserUk (Patriarch) on Jan 11, 2010 at 23:49 UTC | |
by convenientstore (Pilgrim) on Jan 14, 2010 at 16:54 UTC | |
| |
by ikegami (Patriarch) on Jan 11, 2010 at 22:49 UTC |