This so simple bash script ejects the cdrom and immediately pulls it back repeatedly, till the script is manually stopped.

while [ 1 ]
do
eject -T /dev/cdrom
sleep 10
eject -T /dev/cdrom
sleep 10
done

check it out, it can even be used as a baby rocker!