Shell script that would check if the CD-rom is readable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script that would check if the CD-rom is readable
# 1  
Old 05-13-2008
Shell script that would check if the CD-rom is readable

Hi,

I was wondering if there's a command in Linux that would check to see if a CD is inserted into CD-rom.

I am developing a shell script that would copy a file from CD rom. For this, I have to first verify if the CD has been inserted or not.

Can anyone help me?


Thanks,
Sundeep
# 2  
Old 05-13-2008
This would depend on the distribution of linux really, but it's largely going to be down to your automounter. If you are using one, then just use something like:
Code:
if mount | grep cdrom > /dev/null
...

.
If not, then you'll need to test the device - easiest way would be to mount it IMO, something like:
Code:
if mount /mnt/cdrom
...

You might need to first check if it's already mounted, and possibly include a step to unmount it again if you need it unmounted.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

2. Shell Programming and Scripting

check if file is readable by others

hi all, in ksh script how do i detect if a file is readable by others ?? thanks. (6 Replies)
Discussion started by: cesarNZ
6 Replies

3. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

4. Shell Programming and Scripting

How to check if a file is not readable by anyone except the owner?

All, I have a script where I get a filename as input and do some processing with the file that I got as input. Requirement: Now I have a requirement where I need to check the following: If either of this goes wrong, the script should pop out a warning message. I tried searching the... (6 Replies)
Discussion started by: bharath.gct
6 Replies

5. Shell Programming and Scripting

check whether file is readable or not in ksh

i want to check the readability of a file inside the script. when i use if then echo the file "$sourcef" is not readable else echo something fi i am getting the error : f: unknown test operator when i tried to check the availability with if i was... (3 Replies)
Discussion started by: gotam
3 Replies

6. Solaris

cd rom to dvd rom drive swap

Hello, I need to replace a cd rom drive with a dvd rom drive in a SunFire v120 running Solaris 8. My objective is to install Solaris 10 from dvd disc. Downloading Solaris 10 cd discs is not an option since I am in Baghdad, Iraq and connection speeds are horrible. So far, all I can get is power to... (9 Replies)
Discussion started by: 555
9 Replies

7. SuSE

Regarding Readable check for all the files in the folder

Currently we are doing the migration to unix to linux. I am facing the new problem kganeshb@its04489:~/scripts $ ls -l | more total 340 -rw-r----- 1 kganeshb users 9038 Oct 22 13:23 109_db.txt -rw-rw---- 1 dlc users 1413 Oct 10 17:40 1.txt -rw-rw---- 1 kganeshb users 45 Jan 28 13:46 a... (2 Replies)
Discussion started by: kingganesh04
2 Replies

8. Shell Programming and Scripting

CD Rom Locked by shell process

Hi, I am writing a multi-cd spanning installer for a particular software in Linux (Redhat 4 or greater / Suse ) My Program is in Java. A Shell Script is used to fork the java process. I found out that when the Installer tries to go to the next disc when prompted so, by the installer, the eject... (0 Replies)
Discussion started by: jiju.jacob
0 Replies

9. Shell Programming and Scripting

script to convert epoch into human-readable

This is what I have to start out with more file 1208217600 1208131200 1193806800 I want to convert the epoch column into a human-readable format. My file has hundreds of these epoch times that I want to loop through and convert. (The epoch time is really the last column of the line) ... (3 Replies)
Discussion started by: snoman1
3 Replies

10. Shell Programming and Scripting

check in unix shell script so that no one is able to run the script manually

I want to create an automated script which is called by another maually executed script. The condition is that the no one should be able to manually execute the automated script. The automated script can be on the same machine or it can be on a remote machine. Can any one suggest a check in the... (1 Reply)
Discussion started by: adi_bang76
1 Replies
Login or Register to Ask a Question