From owner-freebsd-current Mon Aug 16 20:50: 7 1999 Delivered-To: freebsd-current@freebsd.org Received: from gndrsh.dnsmgr.net (GndRsh.dnsmgr.net [198.145.92.4]) by hub.freebsd.org (Postfix) with ESMTP id 95C8014E10 for ; Mon, 16 Aug 1999 20:50:03 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.9.3/8.9.3) id UAA10347; Mon, 16 Aug 1999 20:49:22 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <199908170349.UAA10347@gndrsh.dnsmgr.net> Subject: Re: Existance of /var/backups for periodic/daily In-Reply-To: <199908170237.WAA92253@cc158233-a.catv1.md.home.com> from "Stephen J. Roznowski" at "Aug 16, 1999 10:37:40 pm" To: sjr@home.net (Stephen J. Roznowski) Date: Mon, 16 Aug 1999 20:49:22 -0700 (PDT) Cc: freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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 -- Rod Grimes - KD7CAX - (RWG25) rgrimes@gndrsh.dnsmgr.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message