HOMEPAGE FORUMS NEWS DOCUMENTATION SCREENSHOTS
SystemRescueCd forums
View unanswered posts | View active topics It is currently 26 Nov 2014, 18:24



Post new topic Reply to topic  [ 4 posts ] 
 Check drive? 
Author Message

Joined: 21 Jan 2008, 15:18
Posts: 12
Post Check drive?
:shock: :shock:
its me again!
I am using the docache option and want to test if a CD is inside of the CD-drive, or I want to wait, until a cd is insert.
Now I googeld and found some ways checking this, but with help from a Programm or with checking a Path where the CD will be automountet...
SO anyone know, how can i check, if the cd is ejected or not?
I searched on CDRecord, but diddn't found a option...


27 Feb 2008, 11:15
Profile ICQ
Site Admin

Joined: 17 Jul 2003, 09:44
Posts: 2700
Post 
I think you can try to read a block from the device to know whether or not there is a cdrom.

I assume the cdrom device is /dev/sr0:

Code:
if dd if=/dev/sr0 of=/dev/null count=1 2>/dev/null
then
        echo "there is a disc"
else
        echo "there is no disc"
fi


27 Feb 2008, 14:35
Profile

Joined: 21 Jan 2008, 15:18
Posts: 12
Post 
yes it works, it checks if a cd ist insert thx, but i don't know if its ejectet or emty but this will work for the start.. thx..


28 Feb 2008, 09:07
Profile ICQ

Joined: 21 Jan 2008, 15:18
Posts: 12
Post 
the Problem is,
Code:
if dd if=/dev/sr0 of=/dev/null count=1 2>/dev/null

is true 1. if there is no disc and 2. if there is a empty disc inside...


28 Feb 2008, 11:55
Profile ICQ
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.