Backup tar

#!/bin/bash

#usageStatement="Usage: $0 <type> (type=A or B)"

a=/Volumes/Seagate-1
b=/Backup_tar
y=$a$b

#backup_A_path="$a/Backup_tar_A"
#backup_B_path="$a/Backup_tar_B"

#case $1 in
#	a | A)
#	x=A
#	y=$backup_A_path;;
#	b | B)
#	x=B
#	y=$backup_B_path;;
#	*)
#	echo $usageStatement
#	exit 1
#esac

# if the drive mount doesn't exist, then exit with an error
if [ ! -d $a ];then
	echo -e "Error:\n\tThe drive mount point $a$b\n\tcould not be found.  Maybe the drive is unplugged, or the power is off."
	exit 1
fi

#read -p "sleep after backup? (y/n)> " input


# error logging function of this script is broken - tar commands
# used to end in " 2>> $errlogfile"
#errlogfile=/Users/billh/scripts/backup/logs/$(date "+%Y-%m-%d")_Backup_$x.txt
errlogfile=/Users/billh/scripts/backup/logs/$(date "+%Y-%m-%d")_Backup_tar.txt

echo "Performing MySQL_Backup (hartung azparcels ticketdb)"
filename=$y/MySQL_Backup.tar
tar -cf "$filename" -C /sw/var/mysql hartung azparcels ticketdb 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Web_Sites_Backup of files and folders in /Public/Web Sites"
filename=$y/Web_Sites_Backup.tar
tar -cf "$filename" -C /Public Web\ Sites 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Master_Backup of files and folders in /Users/billh"
filename=$y/billh_Backup.tar
tar -c --ignore-case --exclude "/Users/billh/Magazines*" -f "$filename" -C /Users billh 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Master_Backup of files and folders in /Public/Drawings"
filename=$y/Drawings_Backup.tar
tar -cf "$filename" -C /Public Drawings 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Work_Backup"
filename=$y/Work_Backup.tar
tar -c --ignore-case --exclude "Work/drawings*" --exclude "Work/graphics*" -f "$filename" -C /Public Work 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Work_Drawings_Backup"
filename=$y/Work_Drawings_Backup.tar
tar -cf "$filename" -C /Public/Work drawings 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Work_Graphics_Backup"
filename=$y/Work_Graphics_Backup.tar
tar -cf "$filename" -C /Public/Work graphics 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Graphics_Backup of files and folders in /Public/Graphics"
filename=$y/Graphics_Backup.tar
tar -cf "$filename" -C /Public Graphics 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Books_Backup of files and folders in /Public/Books"
filename=$y/Books_Backup.tar
tar -cf "$filename" -C /Public Books 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Magazines_Backup"
filename=$y/Magazines_Backup.tar
tar -cf "$filename" -C /Users/billh Magazines 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Pictures_Backup of files and folders in /Public/Pictures"
filename=$y/Pictures_Backup.tar
tar -c --ignore-case --exclude '*.crw.preview' --exclude "Pictures/_RAW*" --exclude "Pictures/iPhoto*" -f "$filename" -C /Public Pictures 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Pictures_Backup of files and folders in /Public/Pictures/iPhoto Library"
filename=$y/Pictures_iPhoto_Backup.tar
tar -c --ignore-case --exclude '*.crw.preview' -f "$filename" -C /Public/Pictures iPhoto\ Library 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Pictures_Backup of files and folders in /Public/Pictures/_RAW"
filename=$y/Pictures_RAW_Backup.tar
tar -c --ignore-case --exclude '*.crw.preview' -f "$filename" -C /Public/Pictures _RAW 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

echo "Performing Adobe_Acrobat_6_Backup of files and folders in /Users/Shared/Adobe PDF 6.0"
filename=$y/Adobe_Acrobat_6_Backup.tar
tar -cf "$filename" -C /Users/Shared Adobe\ PDF\ 6.0 2>> $errlogfile
du -h "$filename"
echo -e "\tDone\n"

# should the computer be put to sleep after the script is finished?
#if [ "$input" == "y" ]; then
#	~/scripts/SleepNow
#fi


exit 0