On Wed, Oct 30, 2002 at 11:18:03PM -0500, Aaron Johnson wrote:
> Back again with a similar question.  I put in place some code a few
> months ago based on a reply from a member.  It is allowing me to run the
> external process correctly, but in doing deployment of the code and
> watching the system memory usage it appears that the process is still
> attached to the mod_perl process.  Here is a snippet of code:
>       close($req_rec->connection->fileno);
>         # added in an attempt to make the process completely seperate
>         $req_rec->cleanup_for_exec(); # untie the socket
>         # chdir '/' or die "Can't chdir to /: $!";
>         close STDIN;
>         close STDOUT;
>         close STDERR;        

You need a POSIX::setsid() in there, too.  That will disassociate you
from the parent process' session, tty, etc.  The chdir / is also a
good idea.

here's the sequence I use, setting $0 is optional:

    chdir "/";
    $0=$name;

    close STDOUT;
    close STDERR;
    close STDIN;

    POSIX::setsid();   # this takes care of controlling terminals




Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to