Fedora Linux Support Community & Resources Center
  #1  
Old 1st July 2008, 03:14 AM
scruffy72 Offline
Registered User
 
Join Date: Feb 2008
Location: Toronto, Canada
Posts: 14
how to determine if dvd is mounted

I wrote a bash script to copy files from the hard-drive to a dvd and then verify the burning by comparing all burned files with the original.

My problem is that I am having trouble remounting the dvd when the burn is complete. The code as I have it works 90% of the time but sometimes the mount call fails because the device is "already mounted or device is busy" or some thing like that.

Automounting is turned off for optical media and I would prefer to keep it that way, so an excerpt from my script looks like this (starting after burning is complete):

Code:
# open and close the drive
eject 
eject -T
sleep 20
mount /mnt/dvd
# another script verifies...
verifymedia /mnt/dvd $1
My question is, does anyone know of a better way to ensure the drive is mounted before proceeding? Mine is not only ugly but it doesn't always work.

Thanks in advance for any suggestions.
Reply With Quote
  #2  
Old 1st July 2008, 08:27 AM
ppesci Offline
Registered User
 
Join Date: May 2006
Location: Caracas, Venezuela
Posts: 1,866
Not a bahs expert but the expression:

Quote:
grep -c /mount/point/of/dvd /etc/mtab
must return 1 if mounted and 0 if not

HTH
__________________
Pietro Pesci Feltri

PowerBook 15" G4 and
MacBook Pro 17" Intel Core 2 Duo
Intel I5 Desktop
Reply With Quote
  #3  
Old 1st July 2008, 03:08 PM
scruffy72 Offline
Registered User
 
Join Date: Feb 2008
Location: Toronto, Canada
Posts: 14
Thanks and yes, actually I had this:

Code:
while ! grep -q /mnt/dvd /etc/mtab ; do
  sleep 5
  mount /mnt/dvd
done
but as it turns out I have another mountpoint at /mnt/dvdiso so the while expression was always true and the block never ran. At this point I just modified it to "/mnt/dvd " with a space at the end but that seems sort of wrong to have to do that.

Ideally, I'd like to pause while whatever it is that runs when you close the dvd drawer (maybe udev? I have no idea) finishes so that the mount command never fails.
Reply With Quote
  #4  
Old 1st July 2008, 06:44 PM
ppesci Offline
Registered User
 
Join Date: May 2006
Location: Caracas, Venezuela
Posts: 1,866
May be you must change the line:

while ! grep -q ^/mnt/dvd$ /etc/mtab ; do

I think this is an exact match.

HTH
__________________
Pietro Pesci Feltri

PowerBook 15" G4 and
MacBook Pro 17" Intel Core 2 Duo
Intel I5 Desktop
Reply With Quote
Reply

Tags
determine, dvd, mounted

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you determine what's in your path royeo Using Fedora 2 8th June 2007 11:24 AM
how to determine PCI ID of ndiswrapper?? wahaha Servers & Networking 0 9th March 2007 09:46 PM
How can I determine my architecture? atrain_old Installation, Upgrades and Live Media 2 1st March 2007 04:30 AM
How to determine whether it is FC3 or FC2? Fedora_Linux EOL (End Of Life) Versions 12 8th June 2005 10:31 PM


Current GMT-time: 03:49 (Saturday, 20-12-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
...Creek Side - Stockholm-Arlanda Airport (ARN) Travel Photos on Instagram - Marina of Koper Travel Photos - Te Whiti Park Instagram Photos - Texas State Fair Photos on Instagram