From owner-freebsd-questions Wed May 15 8:59: 2 2002 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 9711B37B404 for ; Wed, 15 May 2002 08:58:56 -0700 (PDT) Received: (from dan@localhost) by dan.emsphone.com (8.12.2/8.12.3) id g4FFwtqm098739; Wed, 15 May 2002 10:58:55 -0500 (CDT) (envelope-from dan) Date: Wed, 15 May 2002 10:58:55 -0500 From: Dan Nelson To: "Jack L. Stone" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Zapping Email Box Message-ID: <20020515155855.GP8958@dan.emsphone.com> References: <3.0.5.32.20020515094741.0118be50@mail.sage-one.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3.0.5.32.20020515094741.0118be50@mail.sage-one.net> User-Agent: Mutt/1.3.99i X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (May 15), Jack L. Stone said: > Running FBSD-4.5 RELEASE with sendmail-8.11.6 and Qpopper > > As part of a daily digest mailing at midnight, I have a cron job that > copies a mailbox contents to a work file, then a script strips out the > extra header "noise" and sends out the nice clean digest to its members. In > order to cut off the mail box at precisely midnight, I have been "zapping" > the email box to zero it out in order to start another day's collection of > emails right after midnight. I use this command to "zap" the email box: > #echo > mymailbox > > What always worries me is that one of these times, the zap will be made at > a time when the box is "active" with mail throughput and I may break or > corrupt something. I know I could launch an email client to download the > box to empty it, but that adds another possible variable to break the > routine and not clean out the box timely.... the cron time is set at > exactly 23.59 so there is only that 1 minute to do the zapping or cleanout > of the box. So lock the mailbox while you're messing with it. The procmail port provides a "lockfile" command that will dotlock any arbitrary file, with special flags for handling /var/mail/$USERNAME. I use it in all my mail-archiving scripts. In general, you should lock a mailbox any time you read or write to it. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message