in reply to Re: Monitoring after fork && exit
in thread Monitoring after fork && exit

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.

Replies are listed 'Best First'.
Re: Re: Monitoring after fork && exit
by neilwatson (Priest) on May 24, 2003 at 15:14 UTC
    Sorry. The full script asks the user some input questions and then contructs a newsletter to be emailed to customers. I have the program fork && exit after it has all the needed user input.

    After the fork the program waits until the evening before it sends the mail. The other day a user ran the program but newsletter was never sent. As I did not see the user's screen at the time I can't tell whether the script is in error or the user. Thus I wanted to log everything that happens after the fork && exit.

    Neil Watson
    watson-wilson.ca

      fork && exit; open FH, ">logfile" or do{system("logger", "Boom!"); die} print FH "Look ma, I'm logging\n"; etc....

      If that doesn't hit the logfile then check the usual culprits... disc full etc.

      Personally I'd be checking what the user did, rather than the script. I'd suspect the user of hitting Ctrl-C or something, or closing the terminal before the fork.

      In any case, you should consider using 'cron' or 'at' to run scheduled tasks rather than sleeping until midnight - what happens if the system admin reboots the machine?

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