From owner-freebsd-current Thu Aug 26 18:46:57 1999 Delivered-To: freebsd-current@freebsd.org Received: from cc158233-a.catv1.md.home.com (cc158233-a.catv1.md.home.com [24.3.25.17]) by hub.freebsd.org (Postfix) with ESMTP id 0745E14F64 for ; Thu, 26 Aug 1999 18:46:53 -0700 (PDT) (envelope-from sjr@home.net) Received: (from sjr@localhost) by cc158233-a.catv1.md.home.com (8.9.3/8.9.3) id VAA14598; Thu, 26 Aug 1999 21:45:27 -0400 (EDT) (envelope-from sjr) Message-Id: <199908270145.VAA14598@cc158233-a.catv1.md.home.com> Date: Thu, 26 Aug 1999 21:45:27 -0400 (EDT) From: "Stephen J. Roznowski" Subject: Re: Existance of /var/backups for periodic/daily To: freebsd@gndrsh.dnsmgr.net Cc: freebsd-current@FreeBSD.ORG In-Reply-To: <199908170349.UAA10347@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 16 Aug, Rodney W. Grimes wrote: >> The 200-220 periodic files under daily expect that the directory >> /var/backups exist when they run to back up various files. If you >> delete this directory, the "cp" commands will error. >> >> There seems to be two ways to fix the files. >> >> 1. Add a "if [ ! -d $bak ] ; then exit fi" to the top >> of the files, or >> >> 2. Add a "mkdir -p $bak" to the top. >> >> Do others consider this an error, and if so which is the preferred >> fix? > I consider it an error, but prefer neither fix, here is something more > defensive and verbose in light of failure modes: > > if [ ! -e $bak ] ; then > echo "${0}: $bak missing, creating"; > mkdir -p $bak; > else > if [ ! -d $bak ] ; then > echo "${0}: $bak exists and is not a directory, aborting"; > exit 1; > fi > fi Another take on this is to *not* do the backups if the directory doesn't exist... I'll probably send-pr something like the above however.... -- Stephen J. Roznowski (sjr@home.net) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message