Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Apr 2004 17:19:42 +0200
From:      des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        James Housley <jim@thehousleys.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Loosing STDOUT after file rotation
Message-ID:  <xzp1xn6quep.fsf@dwp.des.no>
In-Reply-To: <406C8F4F.1040306@Thehousleys.net> (James Housley's message of "Thu, 01 Apr 2004 16:53:19 -0500")
References:  <406C8F4F.1040306@Thehousleys.net>

next in thread | previous in thread | raw e-mail | index | archive | help
James Housley <jim@thehousleys.net> writes:
> I have a program that I have the is supposed to run forever.  I log
> any output to a log file.  It is run in a startup script like thie:
>
> program_name >> $err_log 2>&1
>
> The problem is that after newsyslog rotates the $err_log file, no more
> data is written to the file.  I can not stop and restart the program.
> I can accept a signal.  But what do I need to do in "program_name" to
> allow the data to be written after the "rotation" of the file.

There is not much you can do unless you modify your program to write
directly to the log file instead of stdout (in which case you just
need to re-open the log file when you get a SIGHUP), or use something
like Apache's logrotate instead of newsyslog (pipe the program's
output to logrotate, which takes care of the rest)

DES
--=20
Dag-Erling Sm=F8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp1xn6quep.fsf>