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

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

Replies are listed 'Best First'.
Re: Re: Re: Monitoring after fork && exit
by jepri (Parson) on May 24, 2003 at 15:23 UTC
    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.