[ale] BASH script - wait for CD insert

Jim Patterson unixdude at gmail.com
Wed Feb 16 10:47:37 EST 2005


Jay,

What you want to do needs to use an ioctl to wait for a media change
event.  I don't know of a way to do that from BASH directly.  If you
try to open the cdrom with something like:
 5</dev/cdrom
but at least on my machine here, that actually closes the drive door and
the tells me that I have no media.  Oh well.

If you can use stuff other than strict shell scripts, then Perl/Python most
likely have the ability to do it, or if you can use and external program then
I would suspect that either of:
http://www.risacher.org/pfl/cd_poll.c
http://www.risacher.org/pfl/cdpoll-new.c

will suit your needs.

Jim P.


On Wed, 16 Feb 2005 02:14:09 +0000, Jay Loden <jloden at toughguy.net> wrote:
> I am scripting a DVD backup solution, and the idea is for the script to email
> the admin when it is ready for the backup, then the admin puts in the DVD and
> the backup is performed.  Does anyone know of a way to eject the CD tray,
> wait for the DVD insert and then when it's inserted, continue on with the
> script (burn the backup)?
> 
> I know how to eject the tray, but not how to wait for and detect insertion of
> the DVD.
> 
> -Jay
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>



More information about the Ale mailing list