From owner-freebsd-questions@FreeBSD.ORG Tue Sep 4 03:45:25 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55E5D16A418 for ; Tue, 4 Sep 2007 03:45:25 +0000 (UTC) (envelope-from roberthuff@rcn.com) Received: from smtp02.lnh.mail.rcn.net (smtp02.lnh.mail.rcn.net [207.172.157.102]) by mx1.freebsd.org (Postfix) with ESMTP id 1D6AB13C465 for ; Tue, 4 Sep 2007 03:45:24 +0000 (UTC) (envelope-from roberthuff@rcn.com) Received: from mr02.lnh.mail.rcn.net ([207.172.157.22]) by smtp02.lnh.mail.rcn.net with ESMTP; 03 Sep 2007 23:45:24 -0400 Received: from smtp01.lnh.mail.rcn.net (smtp01.lnh.mail.rcn.net [207.172.4.11]) by mr02.lnh.mail.rcn.net (MOS 3.8.3-GA) with ESMTP id NST30974; Mon, 3 Sep 2007 23:45:24 -0400 (EDT) Received: from 65-78-26-179.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com (HELO jerusalem.litteratus.org.litteratus.org) ([65.78.26.179]) by smtp01.lnh.mail.rcn.net with ESMTP; 03 Sep 2007 23:45:20 -0400 From: Robert Huff MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18140.54529.1923.789795@jerusalem.litteratus.org> Date: Mon, 3 Sep 2007 23:46:09 -0400 To: L Goodwin In-Reply-To: <813384.83992.qm@web58102.mail.re3.yahoo.com> References: <813384.83992.qm@web58102.mail.re3.yahoo.com> X-Mailer: VM 7.17 under 21.5 (beta28) "fuki" XEmacs Lucid X-Junkmail-Whitelist: YES (by domain whitelist at mr02.lnh.mail.rcn.net) Cc: freebsd-questions@freebsd.org Subject: Handling failed mount (media not connected) 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: Tue, 04 Sep 2007 03:45:25 -0000 L Goodwin writes: > My backup script (sh) works fine except when the > backup drive (USB Flash drive) is not plugged in. I'm > using mount_msdosfs to mount the backup drive. > > What is the best way to handle mount_msdosfs error? > If the drive is not mounted, I want to detect the > failure and execute error-handling code. First approximation, using sh: ls /dev | grep da4s1 if [ $? -eq 0 ]; then # drive is available else # drive is not available if (Replace "da4s1" with whatever the flash drive gets created as.) Robert Huff