From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 2 08:18:46 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 BE46516A4CE for ; Fri, 2 Apr 2004 08:18:46 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 721FA43D31 for ; Fri, 2 Apr 2004 08:18:46 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i32GIiv2014834; Fri, 2 Apr 2004 10:18:44 -0600 (CST) (envelope-from dan) Date: Fri, 2 Apr 2004 10:18:44 -0600 From: Dan Nelson To: James Housley Message-ID: <20040402161844.GB6724@dan.emsphone.com> References: <406C8F4F.1040306@Thehousleys.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <406C8F4F.1040306@Thehousleys.net> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error 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: Fri, 02 Apr 2004 16:18:46 -0000 In the last episode (Apr 01), James Housley said: > 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. Run "program_name 2>&1 | logger daemon.notice -t program_name", so messages go through syslog (/etc/rc.d/bgfsck does this). You can use programname filtering in syslog.conf to write that output to its own logfile. There's nothing program_name itself can do about the problem, since it didn't open the logfile; the shell did. -- Dan Nelson dnelson@allantgroup.com