LinuxQuestions.org
Visit Jeremy's Blog.
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, 02: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, 03:07 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,590

Rep: Reputation: 188Reputation: 188
"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, 04:17 PM   #3
thar
LQ Newbie
 
Registered: Oct 2003
Location: warsaw
Distribution: Own ;)
Posts: 22

Original Poster
Rep: Reputation: 15
big thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:48 AM
Checking device status neerukamra Linux - General 1 09-06-2004 02:12 AM
script check to see if device is mounted Warmduvet Programming 14 09-03-2004 07:17 PM
Checking a USB Device extremebfn Linux - Wireless Networking 2 07-30-2004 09:26 PM
Mounted Device names Rodzilla Linux - Newbie 7 09-25-2003 11:39 AM


All times are GMT -5. The time now is 07:55 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration