Jeff Pang wrote:
* If it's started in a terminal, the output will appear in that terminal, even if started in background and with nohup(1).

* If it's started by cron(1), the output is gathered and e-mail to you when the program terminates.

* If it's started by init(1), the output is send to the console log.

En?I think you are a little poor at daemon programming.

See this example coming from Lincold Stein's book:

-----------------
daemon();
do something...

sub daemon
{
    my $child = fork();
    die "can't fork" unless defined $child;
    exit 0 if $child;
    setsid();
open (STDIN, "</dev/null");
    open (STDOUT, ">/dev/null");
    open (STDERR,">&STDOUT");

    chdir $rundir;
    umask(022);
    $ENV{PATH}='/bin:/usr/bin:/sbin:/usr/sbin';

    return $$;
}
--------------------

Do you still believe you can see the error output on screen?

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com


Not if you purposely turn off the output. But why would you do that? If something went wrong, you could not determine what. And like I said, daemons started by init(1) send their output to the console log. You do regularly inspect your logs, don't you?


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them,
we learn by doing them."
  Aristotle

"The man who sets out to carry a cat by its tail learns something that
will always be useful and which will never grow dim or doubtful."
  Mark Twain

"Believe in the Divine, but paddle away from the rocks."
  Hindu Proverb

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to