[ale] BASH script - wait for CD insert

Michael Hirsch mdhirsch at gmail.com
Wed Feb 16 10:48:24 EST 2005


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.

I don't know of a scripty way to do it, but the CDROM ioctls let you
query for the presence of a CD in the drive.  So you can poll for an
inserted disk.  I've done this in C.  Not all drives correctly support
it, however.  Ot at least, they didn't 4-5 years ago when I last did
this.

Michael



More information about the Ale mailing list