Re: Need suggestions on a backup issue

2012-07-20 Thread Darac Marjal
On Fri, Jul 20, 2012 at 09:50:53AM -0600, Paul E Condon wrote:
 
[cut]
 What test can I code in Bash to determine that there is no disk
 mounted at this mount point? I'm thinking of testing for the
 presence of the file lost+found, but is there something better?

Two points.

1. See if man mountpoint is suitable

2. Don't re-invent the wheel. There are plenty of people who've solved
the backup to a USB disk before you. Some of their work is in debian.



signature.asc
Description: Digital signature


Re: Need suggestions on a backup issue

2012-07-20 Thread Camaleón
On Fri, 20 Jul 2012 09:50:53 -0600, Paul E Condon wrote:

(...)

 What test can I code in Bash to determine that there is no disk mounted
 at this mount point? I'm thinking of testing for the presence of the
 file lost+found, but is there something better?

Check if any of these tips help:

http://stackoverflow.com/questions/9422461/check-if-directory-mounted-with-bash

Greetings,

-- 
Camaleón


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/juc03v$10r$1...@dough.gmane.org



Re: Need suggestions on a backup issue

2012-07-20 Thread Rob Owens
On Fri, Jul 20, 2012 at 09:50:53AM -0600, Paul E Condon wrote:
 
 Debian already provides an email facility that allows cron scripts to
 email me with error messages. I need a way to test in Bash whether, or
 not, there actually is a disk mounted at /media/wdp8. 
 
 What test can I code in Bash to determine that there is no disk
 mounted at this mount point? I'm thinking of testing for the
 presence of the file lost+found, but is there something better?
 
Rather than looking for lost+found (which could be any disk), I'd look
for an identification file that you put on that disk.  For instance,
/media/wdp8/.backupdrive1

I guess you could also grep /etc/mtab for /media/wdp8, but I'm not sure
if that's 100% reliable.

-Rob


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120720162714.gb11...@aurora.owens.net



Re: Need suggestions on a backup issue

2012-07-20 Thread Tixy
On Fri, 2012-07-20 at 09:50 -0600, Paul E Condon wrote:
 I need a way to test in Bash whether, or
 not, there actually is a disk mounted at /media/wdp8. 

A bit hacky, but what I do in my backup scripts is...

   if mount | grep -q  /media/wdp8 
   then
...
   fi

-- 
Tixy


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1342807475.2952.5.ca...@computer2.home



Re: Need suggestions on a backup issue

2012-07-20 Thread Dan Ritter
On Fri, Jul 20, 2012 at 07:04:35PM +0100, Tixy wrote:
 On Fri, 2012-07-20 at 09:50 -0600, Paul E Condon wrote:
  I need a way to test in Bash whether, or
  not, there actually is a disk mounted at /media/wdp8. 
 
 A bit hacky, but what I do in my backup scripts is...
 
if mount | grep -q  /media/wdp8 
then
   ...
fi

One other suggestion:

If you mount a backup drive on /media/wdp8/, have your backup
program start writing to /media/wdp8/backup/, a dir that exists
on the drive but not on your underlying filesystem.

If the directory doesn't exist, it ought to exit with an
appropriate error rather than filling your root filesystem.

-dsr-


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120720182959.gw8...@randomstring.org



Re: Need suggestions on a backup issue SOLVED: mountpoint

2012-07-20 Thread Paul E Condon
On 20120720_122714, Rob Owens wrote:
 On Fri, Jul 20, 2012 at 09:50:53AM -0600, Paul E Condon wrote:
  
  Debian already provides an email facility that allows cron scripts to
  email me with error messages. I need a way to test in Bash whether, or
  not, there actually is a disk mounted at /media/wdp8. 
  
  What test can I code in Bash to determine that there is no disk
  mounted at this mount point? I'm thinking of testing for the
  presence of the file lost+found, but is there something better?
  
 Rather than looking for lost+found (which could be any disk), I'd look
 for an identification file that you put on that disk.  For instance,
 /media/wdp8/.backupdrive1
 
 I guess you could also grep /etc/mtab for /media/wdp8, but I'm not sure
 if that's 100% reliable.
 
 -Rob

The main message is in the Subject:

Your suggestion of .backupdrive1 solves the problem of identity of the
disk which I agree is important and which I had already solved in a
way that I didn't mention: wdp8 is the LABEL of the partition to be
mounted. Giving the partition a LABEL allows some magic in Gnome, or
in the system but invoked by Gnome, to mount the disk automatically.
I like this, but after about a year of operation, once, about 5d ago,
the disk was plugged in but not mounted. 


-- 
Paul E Condon   
pecon...@mesanetworks.net


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120720185428.gb2...@big.lan.gnu



Re: Need suggestions on a backup issue

2012-07-20 Thread Teemu Likonen
Paul E. Condon [2012-07-20 09:50:53 -0600] wrote:

 I need a way to test in Bash whether, or not, there actually is a disk
 mounted at /media/wdp8.

#!/bin/sh

if mountpoint -q /media/wdp8; then
echo Mounted
else
echo Not mounted
fi


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87k3xyurpl@mithlond.arda