#!/bin/sh # # Module: cdloop # Purpose: to restart a CD when it ceases playing # Author: M. M. Eccles # Date: 30 December 1997 # # Notes: If argument v is specified, writes messages to standard out # when status is checked. # # Changes: # Remove logfile, default to empty $DEV for automatic detection. # # RCS: # $Log: cdloop,v $ # Revision 1.2 1998/01/06 21:00:33 wadeh # Added DoCr, changes to fix cdeject crash. # # Revision 1.1 1997/12/30 23:04:10 wadeh # Initial revision # # Notes: # 1) This program uses cdloop and cdplay.... # 2) By default, this uses the default CDROM compiled in cdtools # 3) Usage: # cdloop -- loop default CDROM # cdloop v -- verbose operation # cdloop 1 -- use second CDROM # cdloop v 1 -- verbose, use second CDROM # INT=60 DONE=0 DEV= # fail on errors set -e #assumes cd is already opened if [ "$1" = "1" ] then DEV=-1 echo using drive 1 fi if [ "$2" = "1" ] then DEV=-1 echo using drive 1 fi until [ "$DONE" -eq 1 ] do STATUS=`cdinfo $DEV` if [ "$1" = "v" ] then echo Status is "$STATUS" fi if [ "$1" = "v" ] then NOW=`date +"%m/%d/%y %H:%M:%S"` fi if [ "$STATUS" = "play " ] then if [ "$1" = "v" ] then echo "$NOW Already playing..." fi else if [ "$1" = "v" ] then echo "$NOW: Starting play...." fi cdplay $DEV 1 fi sleep $INT done