From owner-freebsd-questions@FreeBSD.ORG Fri Jan 5 19:04:58 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 328DD16A407 for ; Fri, 5 Jan 2007 19:04:58 +0000 (UTC) (envelope-from af300wsm@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.231]) by mx1.freebsd.org (Postfix) with ESMTP id E116E13C448 for ; Fri, 5 Jan 2007 19:04:57 +0000 (UTC) (envelope-from af300wsm@gmail.com) Received: by wr-out-0506.google.com with SMTP id 55so2473823wri for ; Fri, 05 Jan 2007 11:04:57 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=C6pgCShyVA6pAEWXdRp0WCvKuAU09WWIbKJkaYUzMfg67rRk35R0rXWyHMLxH/DEIPlew+CbreirJBm0GUQaoxiYHOax3AtLO7R0s54ZAJ8i+YMeSUHeafnlt6lCMBBACeGF6Qoswbp3qAbcFMjZjk4Y1d71ot8zLHzvIGckzNI= Received: by 10.78.201.10 with SMTP id y10mr4615135huf.1168023897119; Fri, 05 Jan 2007 11:04:57 -0800 (PST) Received: by 10.78.142.9 with HTTP; Fri, 5 Jan 2007 11:04:56 -0800 (PST) Message-ID: <340a29540701051104v28d9f2acx5052485350dde6de@mail.gmail.com> Date: Fri, 5 Jan 2007 12:04:56 -0700 From: "Andrew Falanga" To: freebsd-questions MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Need to make sure my understanding of newsyslog is correct for a daemon I'm writing X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jan 2007 19:04:58 -0000 Hi everybody, I'm working on the finishing touches to a server program I've just written and one of the things it needs to log information to a log file. I'm going to log to /var/log/file.log and to manage the growth I'm going to add this log file to the newsyslog.conf file. However, I'd like to make sure that the code I'm writing will work with how newsyslog is going to work. Basically, I'm installing a signal handler for SIGHUP to do the following: reset the put pointer to the beginning of the file; flush any data that may be in the buffer; close the file; reopen file; Does this sound correct? I'm going on the assumption (and this is what I want to have clarified) that newsyslog, when it finds that file x meets the rotate criteria, follows these steps: 1) copy file x contents to x.0 2) truncate file x to zero bytes 3) send SIGHUP to process id Is this how newsyslog would truncate the file? Am I missing something? Should my signal handler function look differently? Thanks for any help, Andy