Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
That's assuming he has an rsync daemon running on the other machine. (-a is the same as -rt [more specifically -rlptgoD]). He could use -u, but I think it's unnecessary unless it's a folder used by somebody else as well. –  Githlar Feb 18 '12 at 14:17
    
Greetings: rsync --progress --hurtz /directory/to/backup validUser@172.29.36.10:/destination/for/backup/ Keep in mind that you wont be able to rsync without being prompted for a password, so to rsync without having to type a password you can read this tut: linuxproblem.org/art_9.html –  kingmilo Feb 18 '12 at 14:24
    
the rsync utility is installed in Ubuntu by default. –  kingmilo Feb 18 '12 at 14:30
    
I completely forgot about the fact that he's doing it through a cron job... that might be an issue. Good link. That's how I reach my machine for cron jobs as well. –  Githlar Feb 18 '12 at 14:31
    
But it's not enabled as a daemon. It needs an /etc/rsyncd.conf which isn't provided. And rsync's a picky beast that I only use when absolutely necessary, so I avoid dealing with it at all costs HAHA –  Githlar Feb 18 '12 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.