in reply to Re: Re: Starting a process in the background that lives after perl dies.
in thread Starting a process in the background that lives after perl dies.
#!/usr/bin/perl -w # forker.pl use strict; my $pid = fork(); if ($pid == 0) { exec("/tmp/busy_wait.pl"); } elsif (!defined($pid)) { die "could not fork"; } print "This is the parent process\n";
When I execute forker.pl, I get this output:#!/usr/bin/perl -l # busy_wait.pl while (1) { print "Busy!"; sleep 2; }
The parent dies, and I get my shell prompt back, but the busy_wait.pl child lives on until I purposefully kill it.[matt@megatron ~]$ /tmp/forker.pl Busy! This is the parent process [matt@megatron ~]$ Busy! Busy! Busy!
-Matt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Starting a process in the background that lives after perl dies.
by ehdonhon (Curate) on Nov 09, 2001 at 01:09 UTC |