LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-06-2004, 07:20 PM   #1
Hiper
Member
 
Registered: Aug 2003
Location: Portugal
Distribution: Slackware 10.0
Posts: 100

Rep: Reputation: 15
notification on cd insert/eject


Hi
I am looking for some sort of daemon that does "something" when a cd is inserted.
If it could also do "something" when the eject button on the drive is pressed that would be nice too

It has got to be something simple, CLI only and very little dependencies if possible!

Or maybe someone can tell me how can i do this from a shell script or a simple C program?

Thanks in advance

Last edited by Hiper; 11-06-2004 at 07:22 PM.
 
Old 11-06-2004, 08:43 PM   #2
battousai9439
Member
 
Registered: Jul 2004
Distribution: Ubuntu 10.04
Posts: 32

Rep: Reputation: 15
um...

WHY would you want this?
 
Old 11-06-2004, 09:54 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
cdrecord has an option called --inq which inquires about the status of your cdrom drive.
David Stark ( I think ) had a cd multiburn script posted here a while back and it had a section which used that feature. Basically, it went something like this ....

Code:
#!/bin/sh
#
      STATUS=`cdrecord -V --inq dev=0,0,0 2>&1`
      echo $STATUS | grep "medium not present" &> /dev/null
      if [ $? != 0 ]
	  then
	  echo "The cd is loaded "
else
echo -e " \a The cd is not loaded"
fi
 
Old 11-06-2004, 10:13 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
yea even using c the interface is limited
to the same basic look see status like the script someone posted
and there is no interface to the button thingy
 
Old 11-06-2004, 10:28 PM   #5
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Rep: Reputation: 30
Going to have to be creative on this one.

Perhaps:

ls /mnt/cdrom

if output is blank (no files) then no CD is loaded (either that, or a blank CD)

if it returns output with any characters except spaces or returns... there's somethin' in there, report cdrom as loaded!

Do something like that ;-)
 
  


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
How to eject a CD skie_knite007 Programming 7 11-24-2011 11:50 AM
VCD does not eject even eject button pressed ic_torres Linux - Software 4 12-01-2005 06:40 PM
Cd won't eject techrolla Fedora 13 11-29-2003 09:45 PM
CD Won't Eject With "eject" Command Dr. Ephemeron Slackware 13 11-13-2003 01:27 AM
E-Mail notification to users via SMS (gateway script ok, but notification script?!?) Riku2015 Linux - Networking 10 03-08-2002 11:16 AM

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

All times are GMT -5. The time now is 04:11 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