Asks cdromd daemon information about a device.
The cdcheck command sends an appropriate command to the cdromd daemon to get information on a media or a device depending on the flag used.
The cdcheck command returns a zero (True) exit value and prints a message on stdout if the specified condition is true. Otherwise, the cdcheck command returns a nonzero (False) exit value and prints an error message on stderr.
       cd<x> is managed by cdromd.       cd<x> is not mounted.       No media present in cd<x>.When using cdcheck in shell scripts, the -q flag can be added to the cdcheck command so that no messages are printed on stdout and stderr. The only exception is the cdcheck command with the -m flag, which always prints the mount point on stdout so that the shell script can get this mount point.
| Item | Description | 
|---|---|
| -a | Checks if a device is managed by cdromd. | 
| -e | Checks if a media has been ejected from a device. | 
| -h or -? | Displays the command usage message. | 
| -m | Checks if a media is mounted on a device. | 
| -q | Specifies silent mode: Doesn't print any information
or error message. Note: If -q is used with the -m flag,
the mount point will be printed to stdout. | 
| -u | Checks if a media is not mounted on a device. | 
| DeviceName | Specifies the name of the device. | 
This command returns the following exit values:
cdcheck -a cd0cdcheck -m -q cd1      cdcheck -u cd1cdcheck -e cd0DEVICE=$1
if [ cdcheck -a -q "$DEVICE" ]; then
    AUTO_MOUNT="ON"
else
    AUTO_MOUNT="OFF"
fi
# Other initializations
# ...
if [ "$AUTO_MOUNT" = "ON" ]; then
    MOUNT_POINT=`cdcheck -m -q $DEVICE`
else
    MOUNT_POINT="/tmp/MyProg_$$"
    mount -rv cdrfs $DEVICE $MOUNT_POINT
fi
if [ $? -ne 0 ]; then
    echo "mount $DEVICE failed"
    exit 1
fi
# Now extract data from $MOUNT_POINT...
# ...
# End of processing. Umount the media
if [ "$AUTO_MOUNT" = "ON" ]; then
    cdeject -q $DEVICE
else
    unmount $DEVICE
fi
if [ $? -ne 0 ]; then
    echo "unmount $DEVICE failed"
    exit 1
fi