From owner-freebsd-questions@FreeBSD.ORG Sun May 18 02:16:28 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7ED1037B401 for ; Sun, 18 May 2003 02:16:28 -0700 (PDT) Received: from dentrita.perpels.com (217-126-9-95.uc.nombres.ttd.es [217.126.9.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE2D643FA3 for ; Sun, 18 May 2003 02:16:26 -0700 (PDT) (envelope-from drio@perpels.com) Received: from big.perpels.com (unknown [192.168.0.5]) by dentrita.perpels.com (Postfix) with ESMTP id 5EB81F4 for ; Sun, 18 May 2003 11:16:25 +0200 (CEST) Received: by big.perpels.com (Postfix, from userid 1000) id 56E4D540D; Sun, 18 May 2003 11:16:25 +0200 (CEST) Date: Sun, 18 May 2003 11:16:25 +0200 From: David Rio To: freebsd-questions@freebsd.org Message-ID: <20030518091625.GA11341@perpels.com> References: <20030516070445.GA43651@perpels.com> <44bry1ngdc.fsf@be-well.ilk.org> <20030518060417.GA670@sten.alder.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030518060417.GA670@sten.alder.net> User-Agent: Mutt/1.4.1i Subject: Re: how to know if there is a cd inside the cdwriter X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 May 2003 09:16:28 -0000 On Sun, May 18, 2003 at 02:04:17AM -0400, Bob Hall wrote: > David Rio writes: > > > I am writing a little script to backup my data. I would like > > to know if there is a CD inside the cdwriter before launch the > > burn process. Any idea? > > Here's a snippet from a bash script I use to do the same thing with > a dvd burner. The burner is external, so the script has alread checked > to see if the burner is mounted. > > melding=$(sudo mount -t ufs -o rw /dev/cd0a $montering_punkt 2>&1) > #Om mount ikke returnerer 0, er noe galt. > if [ $? -ne 0 ] > then > if [ "$melding" = "mount: /dev/cd0a: Device not configured" ] > then Thanks. I have received another answer from Lowell Gilbert that point me to use "cdcontrol info" and then parse the output. This one is good too.