Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Proper Forking

by decnartne (Beadle)
on Jul 24, 2001 at 23:33 UTC ( [id://99458]=note: print w/replies, xml ) Need Help??


in reply to Proper Forking

in answer to your first question, one way to use fork() that has worked for me is the following:
unless( fork )
{
   exec "/some/cmd/here";
}
i believe your script hangs since your getppid never returns a 1. instead, it is returning the pid of the forked child's parent - in this case A.pl - which will not be process id 1. process id 1 is probably your box's /etc/init process if it's unix and not even there if on win32...

decnartne ~ entranced

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-03-17 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.