Asks cdromd daemon information about a device.
cdcheck { -a | -m | -u | -e } [ -q ] [ -h | -? ] DeviceName
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.
To check if a device is managed by cdromd daemon, use the cdcheck command with the -a flag. If the cdromd daemon is running and the specified device is in its device list, the cdcheck -a command will return with a zero (True) exit value after printing the following message on stdout:
cd<x> is managed by cdromd.
To check if a media is present and was mounted by cdromd daemon, use the cdcheck command with the -m flag. When a media is inserted in a drive, it can take several seconds or tens of seconds before it become ready and mounted. The cdcheck -m command waits until the end of the mount operation by the cdromd daemon. If this operation is successfull, the cdcheck -m command returns with a zero (True) exit value after printing the mount point on stdout.
To check if a media is present but was unmounted by the cdumount command, use the cdcheck command with the -u flag. If the cdromd daemon is running and the specified device is in in unmounted state, the cdcheck -u command will return with a zero (True) exit value after printing the following message on stdout:
cd<x> is not mounted.
To check that there is no media present in the specified device, use the cdcheck command with the -e flag. If the cdromd daemon is running and there is no media present in the drive, the cdcheck -e command will return with a zero (True) exit value after printing the following message on stdout:
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.
This command returns the following exit values:
cdcheck -a cd0
cdcheck -m -q cd1
cdcheck -u cd1
cdcheck -e cd0
DEVICE=$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
The cdeject command, cdmount command, cdromd daemon, cdumount command, cdutil command.
The cdromd.conf file format.