I put together a script that opens the CD tray, plays a .wav file, and then closes the tray. It does so every hour, as many times as the current number of hours. However, after every cycle, there seems to be a large slow-down. What could this be linked to? Is there any way to debug it?
#!/bin/bash KUKU=`/bin/date +%H` # Get the current hour KUKU=$((10#$KUKU)) # Convert it to decimal, in case it is 01, etc. if $KUKU -gt 12 ]; then # Convert to a 12 hour clock. KUKU=$((KUKU-12)) elif $KUKU -eq 0 ]; then # Midnight KUKU=12 # Same amount as at noon fi while $KUKU -gt 0 ]; do eject /dev/cdrom aplay /mnt/storage/Music/kuku.wav # The file - plays successfully eject -t /dev/cdrom KUKU=$((KUKU-1)) # Decrement done
I have added comments now, but they are not in the main file, and so it cannot be caused by them - except the #!/bin/bash comment, but that is required.
By adding “echo step” after each value, it seems that it takes a long time for the CD tray to be retrieved - far longer than it physically does. Any ideas?