How to back up the old files on the target server before rsync replaces them with new ones?
Use –backup option in rsync. For instance,
# rsync -a –backup –backup-dir=”/version2″ /var/log/ root@192.168.122.246:/var-log-bk/This command will copy files from local /var/log to root@192.168.1.100:/var-log-bk/ if rsync overrides some files in 192.168.1.100:/var-log-bk/. It will back up those files to 192.168.1.100:/version2/ first.
Purchase Dedicated Servers
Select, configure, and buy!
Click Here