LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-22-2004, 01:52 PM   #1
thar
LQ Newbie
 
Registered: Oct 2003
Location: warsaw
Distribution: Own ;)
Posts: 22

Rep: Reputation: 15
Checking if a device is mounted using a script


hi!

i would like to write a script which does the following actions:
1. In case the cdrom is mounted, unmount and eject it.
2. In case it isn't mount it.

Now I have these simple questions:
How do I check if a device is mounted?
How do I eject a cd?

Thanx!
 
Old 02-22-2004, 02:07 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"How do I check if a device is mounted?"

Use the mount command without any parameters to give you a list of all mounted devices and search the output using grep:
mount | grep (grep parameters)
if test $? -eq 0;
then

"How do I eject a cd?"
Use the eject command.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
Old 02-22-2004, 03:17 PM   #3
thar
LQ Newbie
 
Registered: Oct 2003
Location: warsaw
Distribution: Own ;)
Posts: 22

Original Poster
Rep: Reputation: 15
big thanks.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
swap device not getting mounted jacobselvin Linux - Newbie 9 07-20-2005 09:48 AM
Checking device status neerukamra Linux - General 1 09-06-2004 01:12 AM
script check to see if device is mounted Warmduvet Programming 14 09-03-2004 06:17 PM
Checking a USB Device extremebfn Linux - Wireless Networking 2 07-30-2004 08:26 PM
Mounted Device names Rodzilla Linux - Newbie 7 09-25-2003 10:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration