Ubuntu: How to backup user files automatically via rsync?



Question:

I need to take incremental backup of users files which is located in the following location automatically using a cron job. Could anyone explain the procedure to take backup using rsync in detail pls?

Location: /home/user1/Desktop/

Note: The backup should be saved as follows, if the system IP is 172.29.36.10 the backupfile should be named as user10 and so on. How to acheive this ?


Solution:1

Open a terminal and type: man rsync

But seriously, if you're just wanting to do a backup that copies what you currently have in ~/Desktop to that location and not store any backlog or anything like that you could use:

rsync -azve ssh --delete /home/user1/Desktop 172.29.36.10:/Desktop/backup/folder

You'll have to install openssh-server on the receiving side though. Or you could create a script in /etc/init.d to start rsync --deamon on the remote machine at boot and remove the e ssh part

Here's a breakdown of the options: -a archive mode (recurse directories and keep permissions, etc), -v verbose mode, -e ssh use the SSH protocol for the transfer, --delete delete extraneous files on the receiving side.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »