query cdrw tray

Michael R. Wayne wayne at staff.msen.com
Fri Dec 17 09:00:16 PST 2004


On Fri, Dec 17, 2004 at 12:11:52PM -0700, Ed Stover wrote:
> 
> How to I ask the CD burner if it's tray is open or closed? I am creating
> a automagical shell script to do semi-unattended backups and need to
> figure out how to make sure there is a cd in the tray before I start
> burning. Any help would be greatly appreciated.

Having solved this once before, here's the code I used:

   #!/bin/sh 

   # Spin wait for a CD into the drive
   while /usr/X11R6/bin/cda status | /usr/bin/grep -q '^No_Disc' 
   do
	   sleep 1;
   done



More information about the freebsd-hackers mailing list