My own backups are done in a similar fashion. I also have a couple of clients where I use an external NAS device as a backup medium. Not sure if its a better way of detecting that the device is mounted, but this is what I use to backup to the NAS:
~!/bin/bash
/sbin/e-smith/signal-event pre-backup
mount -t cifs -o user=synback%password-123 //pandoar/gback /mnt/smb
sleep 10
if [ -d /mnt/smb/files ]; then
/usr/bin/synbak -s goldie -m tar -M gz
sleep 20
/sbin/e-smith/signal-event post-backup
umount /mnt/smb; exit
else
echo "`date +%m-%d-%H:%M` Mount failed, backup aborted" >> /var/log/synbak.log
fi
Detecting the mount that way depends on their being a directory with a known name on the mounted device. Since I want to put the backups into that directory, it should be there...
I found I needed the sleep statements because mount took some time to settle, and if I let the script proceed too fast, it would fail. I also added the 'else' statement to log any attempts that fail because the mount has failed (because some $%^$%# in the office decided to be green and turned the NAS off...). The 'signal-event' commands are specific to SME server, first doing a dump of the MySQL databases, then cleaning up at the end of the backup.
I'm also lazy - I use synbak to do the backup itself, and I create the backup as a compressed tar file, which makes sure all file permissions are correctly stored, even though the backup is going to a file system that does not understand Linux permissions and owner/group attributes.
As to the errors you are getting from rsync, what file system are you using on the USB drive? That could have a lot to do with that sort of error.
Not sure about the failure to return to return to the user's home directory. As an alternative, cd entered without arguments should have the same effect. Have you tried that?
paul.