Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Wait for a CD to be inserted then copy the contents
- #
- echo "CD copy, press <ctrl>C to exit"
- echo "Looking for disk..."
- #
- # Go into a continuous loop always looking for a new CD
- while :
- do
- ####### Get the mount point of /dev/sr0 out of the mounts file
- TEST=$(grep /dev/sr0 /proc/self/mounts)
- ####### If it doesn't exist, loop until it does with 1 second pause
- if [ "$TEST" == "" ]; then
- echo -ne "."
- sleep 1
- else
- echo
- ############### Got it! Need to strip the mount point out of the string
- TEST2=${TEST:9}
- set $TEST2
- TEST=$1
- ############### Do the copy process for the disk we found
- echo "Copying from $TEST"
- cp -vr $TEST/* ~/Music/
- ############### Eject the CD with suitable pauses to avoid any buffer problems
- sleep 1
- eject /dev/sr0
- sleep 2
- fi
- ######## Still looping! Go back and wait for another CD!
- done
- exit()
- Copying from /run/media/doug/Blues\040mp3s\040Vol\0409
- cp: cannot stat '/run/media/doug/Blues\040mp3s\040Vol\0409/*': No such file or directory
- Error unmounting block device 11:0: GDBus.Error:org.freedesktop.UDisks2.Error.DeviceBusy: Error unmounting /dev/sr0: Command-line `umount "/run/media/doug/Blues mp3s Vol 9"' exited with non-zero exit status 32: umount: /run/media/doug/Blues mp3s Vol 9: target is busy
- (In some cases useful info about processes that
- use the device is found by lsof(8) or fuser(1).)
- eject: unmount of `/run/media/doug/Blues mp3s Vol 9' failed
- Copying from /run/media/doug/Blues\040mp3s\040Vol\0409
- cp: cannot stat '/run/media/doug/Blues\040mp3s\040Vol\0409/*': No such file or directory
Advertisement
Add Comment
Please, Sign In to add comment