I've been using a process that was developed by macmule. It's mostly still working across the various OS's. However, I'm trying to get it to sync to an external drive rather than an internal drive. When I point the script to the external drive, the script seems to be running prior to the drive being registered, so the script is creating a folder in /Volumes and starts replicating. The drive then finishes mounting, but has a 1 appended to the end which makes it the wrong path. I tried adding a sleep timer but it didn't seem to work (shown).
I've tried
'"/Volumes/Peg...."'
and with various versions of ", `, and even manually putting the path in with \\ commands (.../Pegasus\\ -\\ SA)
Here's how it's setup now.
sleep 15
emailAlert=$(/usr/bin/rsync -avrpogz --delete --log-file=/private/var/log/rsync.log -e ssh ':"/Volumes/Promise RAID-File Share/CasperShare"' "/Volumes/Pegasus - SA")