Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Apr 2004 11:41:12 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Dag-Erling Sm?rgrav <des@des.no>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Loosing STDOUT after file rotation
Message-ID:  <20040427084112.GF966@straylight.m.ringlet.net>
In-Reply-To: <xzp1xn6quep.fsf@dwp.des.no>
References:  <406C8F4F.1040306@Thehousleys.net> <xzp1xn6quep.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

--d6Gm4EdcadzBjdND
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Apr 02, 2004 at 05:19:42PM +0200, Dag-Erling Sm?rgrav wrote:
> 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.
>=20
> 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)

Or, as an alternative to Apache's logrotate, there is multilog from
djb's daemontools package - ports/sysutils/daemontools,
http://cr.yp.to/daemontools.html

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
because I didn't think of a good beginning of it.

--d6Gm4EdcadzBjdND
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAjhyo7Ri2jRYZRVMRAshnAJ92NkvppN43in2ME8Hxcnivs2gE+wCgqAkJ
g81DAJgLpjccJpXutIjupg8=
=Q+Jc
-----END PGP SIGNATURE-----

--d6Gm4EdcadzBjdND--



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