how to know if there is a cd inside the cdwriter

Bob Hall rjhalljr at starpower.net
Sat May 17 23:06:45 PDT 2003


David Rio <drio at perpels.com> writes:
 
> I am writing a little script to backup my data. I would like 
> to know if there is a CD inside the cdwriter before launch the
> burn process. Any idea?

Here's a snippet from a bash script I use to do the same thing with 
a dvd burner. The burner is external, so the script has alread checked 
to see if the burner is mounted.

        melding=$(sudo mount -t ufs -o rw /dev/cd0a $montering_punkt 2>&1)
        #Om mount ikke returnerer 0, er noe galt.
        if [ $? -ne 0 ]
        then
                if [ "$melding" = "mount: /dev/cd0a: Device not configured" ]
                then

HTH, 
Bob Hall


More information about the freebsd-questions mailing list