#!/bin/bash
## This is the section you modify
DESTINATION=/dev/we-love-external-backups
FSTYPE="vfat"
UUID="013A-2D52"
## End of section you modify
function find_device {
DEVNAME="`find /dev/disk/by-uuid/ -type l -name $UUID -printf "%l"`"
if [ -n "$DEVNAME" ]; then
DEVNAME="/dev/`basename $DEVNAME`"
if [ -z "`mount | grep "^$DEVNAME"`" ]; then
mount -t $FSTYPE $DEVNAME $DESTINATION
EC=$?
eval "$1=1"
else
EC=0
eval "$1=0"
fi
else
echo "The drive (UUID=$UUID) is not connected."
EC=1
fi
return $EC
}
find_device UNMOUNT
if [ $? -eq 0 ]; then
## Comands to copy stuff go here
## End of cmmands to copy stuff
else
echo "Couldn't find the drive or it failed to mount."
fi