From owner-freebsd-questions@FreeBSD.ORG Sat Jun 21 22:27:44 2008 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 B2BE8106564A for ; Sat, 21 Jun 2008 22:27:44 +0000 (UTC) (envelope-from chuckr@telenix.org) Received: from mail1.sea5.speakeasy.net (mail1.sea5.speakeasy.net [69.17.117.3]) by mx1.freebsd.org (Postfix) with ESMTP id 9B8218FC18 for ; Sat, 21 Jun 2008 22:27:44 +0000 (UTC) (envelope-from chuckr@telenix.org) Received: (qmail 30566 invoked from network); 21 Jun 2008 22:27:44 -0000 Received: from april.chuckr.org (HELO april.telenix.org) (chuckr@[66.92.151.30]) (envelope-sender ) by mail1.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 21 Jun 2008 22:27:43 -0000 Message-ID: <485D7DDA.8080400@telenix.org> Date: Sat, 21 Jun 2008 18:16:58 -0400 From: Chuck Robey User-Agent: Thunderbird 2.0.0.6 (X11/20071107) MIME-Version: 1.0 To: Helge Rohde References: <200806212144.09925.heroh@gmx.de> In-Reply-To: <200806212144.09925.heroh@gmx.de> X-Enigmail-Version: 0.95.5 OpenPGP: id=F3DCA0E9; url=http://pgp.mit.edu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: shellscript conditional to check for external disk 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: Sat, 21 Jun 2008 22:27:44 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Helge Rohde wrote: > Hello List, > > I need to write a backup script, and one of the required actions would be a > copy of the backup to an external firewire drive. I would like to make this > as easy as possible for the local staff, so i'd like to check whether the > drive is attached, if necessary mount it, copy over the backup and unmount > it again, so that the local staff can swap the external disks when they're > not used. > > Is there a canonical way to achieve what i want? I played with the idea of > simply checking for /dev/da0s1d's existance, but that won't disappear on > disconnect, so that would leave the is a possibility that although da0 is > in /dev, it might not be connected. > > Any ideas or RTFM-pointers? I'm not certain this will do what you want with enough security, but if you put the commands in to mount the dist into /etc/fstab, then later on your ask simply "mount ", mount will follow those rules to mount the disk, if it's indeed in existence. Putting that into a script is pretty simple. There are a huge number of backup commands ... I rather like tar, which can be made to automatically compress the output, or to ask for a single file out of the whole archive, on restoral. Either way, not hard to automate. Does this fit what you wanted? There's a good man page on fstab, and y9ou shouold read the pages on mount and tar. > > Helge > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIXX3az62J6PPcoOkRArsiAJ0f/b3bQbChB9t48EUu5HhznTaetwCfc5OJ VGflPb3nUXht709CGpaUPUQ= =/zdL -----END PGP SIGNATURE-----