To run rsync from Windows on Unix / Linux, you must provide a command like
SET BACKUP_SERVER=my.backup.server SET SSH_USER=theUnixUserName SET STORAGEPATH=/home/%SSH_USER%/Backup/ SET STORAGEURI=%BACKUP_SERVER%:%STORAGEPATH% SET SSH_ID=/cygdrive/c/Users/theWindowsUserName/Documents/keyfiles/id_dsa SET EXCLUDEFILE=backup_excludes.txt SET BACKUPLOGFILE=/cygdrive/c/Users/theWindowsUserName/Backuplogs/backup-%DATE%-%TIME::=-%.log
Then ssh command
SET BACKUP=rsync -azvu --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --rsh="ssh -l %SSH_USER% -i '%SSH_ID%'" --exclude-from=%EXCLUDEFILE% --delete --delete-excluded --log-file="%BACKUPLOGFILE%"
with backup_excludes.txt containing strings of ignored items, e.g.
.git .svn .o \Debug \Release
Then you would use this in a script with
%BACKUP% /cygdrive/c/mySensibleData %STORAGEURI% %BACKUP% /cygdrive/c/myOtherSensibleData %STORAGEURI% %BACKUP% /cygdrive/c/myOtherSensibleData2 %STORAGEURI%
etc. This will back up your directories mySensibleData strong>, myOtherSensibleData strong> and myOtherSensibleData2 with permissions of 755 for directories and 644 for files. You also get backup logs at % BACKUPLOGFILE% for each backup.
codingdave Aug 15 '13 at 14:25 2013-08-15 14:25
source share