neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that is behaving unexpectedly after this snipped:

# fork and free the user close(STDERR); close(STDOUT); fork && exit; ....

How could I log everything that comes afterward yet still free the user to close their login session (linux)?

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Monitoring after fork && exit
by jdporter (Paladin) on May 24, 2003 at 14:06 UTC
Re: Monitoring after fork && exit
by jepri (Parson) on May 24, 2003 at 14:06 UTC
    Why are you closing them?

    Update: Why are you closing them before the fork, if you want to print things afterwards?

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

      The program moves to the background to be executed later in the day. I want the user to be free to logout.

      Neil Watson
      watson-wilson.ca

        You don't need to close them to allow the user to logout, you just need to ignore SIGPIPE. But you still haven't explained what goes funny after you close them and fork. If you are doing something like trying to print after you close them, then of course things will go funny.

        The more information you can give us, the closer to an answer we can get. I'll skip the usual ACME::MindReader joke here..

        ____________________
        Jeremy
        I didn't believe in evil until I dated it.