shammi000 has asked for the wisdom of the Perl Monks concerning the following question:
I have opened the file handle LOG before calling daemonize and, after the deamonize, i have one more function to do the slow query kill. I am not able to view any of the log messages i am writing from the child process in LOG. also query killing is not happening. I can see the child pid running when checked with ps. Please help me. Shammisub Daemonize() { my $pid; $pid=fork(); if(! defined($pid) ){ #Forking Failed, we exit at this point die("forking failed\n"); exit(1); } if ($pid>0) { print LOG "Forking Success. Child PID: $pid \n"; exit(); } $|=1; print LOG "Child Process Executing... \n"; setsid(); chdir('/'); umask(0); close(STDIN) ; close(STDOUT) ; close(STDERR) ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: forked child process is not able to access the file handle
by chromatic (Archbishop) on Jan 27, 2010 at 21:39 UTC | |
|
Re: forked child process is not able to access the file handle
by Krambambuli (Curate) on Jan 27, 2010 at 21:57 UTC |