I cant see anything obvious wrong...so heres the code...any help would be greatly appreciated!
!/bin/sh
# backup.sh -- backup to a local drive using rsync
# Directories to backup.
SOURCES="/home /etc /root /usr /boot /var /"
#for testing uncomment
#SOURCES="/home/abc"
# Directory to backup to.
BACKUPDIR="dailybackup"
LOG_FILE="/etc/rsyncbackup.txt"
TARGET="/Linkstation/"$BACKUPDIR
#EXCLUDE_FILE tells rsync what NOT to backup.
EXCLUDE_FILE="/bin/exclude_file.txt"
# delete contents of log so it doesnt grow too large
echo > $LOG_FILE
#add date to the first line of the log file
string=`date +%m/%d/%y`
echo $string >> $LOG_FILE
# Comment out the following line to disable verbose output
VERBOSE="-v"
###########################
if [ ! -x $TARGET ]; then
echo "Creating directory"
mkdir $TARGET/$BACKUP_DATE
fi
if [ ! -x $TARGET ]; then
echo "Backup target does not exist or you don't have permission!"
echo "Exiting..."
exit 2
fi
echo "Verifying Sources..."
for source in $SOURCES; do
echo "Checking $source..."
if [ ! -x $source ]; then
echo "Error with $source!"
echo "Directory either does not exist, or you do not have proper permissions."
exit 2
fi
done
if [ -f $EXCLUDE_FILE ]; then
EXCLUDE="--exclude-from=$EXCLUDE_FILE"
fi
echo "Sources verified. Running rsync..."
for source in $SOURCES; do
# Create directories in $TARGET to mimick source directory hiearchy
if [ ! -d $TARGET/$source ]; then
mkdir -p $TARGET/$source
fi
rsync $VERBOSE --exclude=$TARGET/ $EXCLUDE --exclude '/Linkstation/**' -rt --delete $source/ $TARGET/$source/ >> $LOG_FILE
done
exit 0