From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 27 01:41:19 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E2C416A4CE for ; Tue, 27 Apr 2004 01:41:19 -0700 (PDT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 8A14343D4C for ; Tue, 27 Apr 2004 01:41:17 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 15944 invoked from network); 27 Apr 2004 08:34:24 -0000 Received: from office.sbnd.net (HELO straylight.m.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 27 Apr 2004 08:34:23 -0000 Received: (qmail 56129 invoked by uid 1000); 27 Apr 2004 08:41:12 -0000 Date: Tue, 27 Apr 2004 11:41:12 +0300 From: Peter Pentchev To: Dag-Erling Sm?rgrav Message-ID: <20040427084112.GF966@straylight.m.ringlet.net> Mail-Followup-To: Dag-Erling Sm?rgrav , James Housley , freebsd-hackers@freebsd.org References: <406C8F4F.1040306@Thehousleys.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i cc: freebsd-hackers@freebsd.org Subject: Re: Loosing STDOUT after file rotation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2004 08:41:19 -0000 --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 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--