Afternoon ServerFault,
I have hit a problem that I can seem to reach a solution to, I currently have a backup script that is meant to rsync VMs off our VMWare box onto our backup server, the problem I have hit is this
**** Starting New Backup
Date: Thu Jan 29 14:09:44 EST 2015
Host: vmhost2
Backup Location: /srv/backups/prod
Dry Run: true
+++=== New VM Backup [27] on [vmhost2] ===+++
---> Target: iDRAC\ Nat
---> VM State: off
rsync -avzhP --delete-after --stats -n root@vmhost2:"/vmfs/volumes/OfficeProd/iDRAC\ Nat" "/srv/backups/prod"
---> RSYNCing VM files
Unexpected local arg: Nat"
If arg is a remote file/dir, prefix it with a colon (:).
rsync error: syntax or usage error (code 1) at main.c(1246) [Receiver=3.0.9]
---! RSYNC Failed, ...
..... truncated .....
+++=== Backup Finished For [27] on [vmhost2] ===+++
An error occurred. Please check /var/log/backups/prod.log
But if I run the command echoed, it works fine
$ rsync -avzhP --delete-after --stats -n root@vmhost2:"/vmfs/volumes/OfficeProd/iDRAC\ Nat" "/srv/backups/prod"
receiving file list ...
16 files to consider
iDRAC Nat/
iDRAC Nat/iDRAC Nat-e4289c3b.vswp
iDRAC Nat/iDRAC Nat-flat.vmdk
....truncated....
sent 71 bytes received 411 bytes 321.33 bytes/sec
total size is 17.83G speedup is 36996625.28 (DRY RUN)
Here is how I can trying to run the command in the script
Note: $rsynccmd is set by rsynccmd="rsync -avzhP --delete-after --stats"
if $dryrun
then
rsynccmd_compiled="$rsynccmd -n root@$vmhost:\"$datastore\" \"$backupprefix\""
echo $rsynccmd_compiled
else
rsynccmd_compiled="$rsynccmd root@$vmhost:\"$datastore\" \"$backupprefix\" 2>&1"
fi
log "---> RSYNCing VM files"
cmdresult=`$rsynccmd_compiled`
EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
chkcmd $? rsync.backup "$cmdresult"
log "---! RSYNC Failed, trying again $retrylimit more times"
EXITCODE=1
retrycount=0
until [ $EXITCODE -eq 0 ]; do
retrycount=$((retrycount + 1))
if [ $retrycount -gt $retrylimit ]
then
break
fi
log "---> RSYNC Retry #$retrycount"
cmdresult=`$rsynccmd_compiled`
EXITCODE=$?
chkcmd $EXITCODE rsync.backup.retry "$cmdresult"
sleep 5
done
fi
Any help with this is highly appreciated!