Register
It is currently Thu Oct 30, 2014 11:38 am

Transfer file between servers


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Sep 13, 2011 5:56 am   

Joined: Tue Sep 13, 2011 12:55 am
Posts: 1
Hi..

I need a script to transfer many backup files(in tar format) from one server to another server and set a weekly cron job..
The thing is that, when the second time it is updated, only the changed files need to be updated and the rest remains unchanged.


thanks in advance


Top
 Profile  
 PostPosted: Tue Sep 13, 2011 9:49 am   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
Hello harithahv! The command you're looking for is 'rsync'

It will automatically only copy files that have changed. A simple cron job for rsync would look something like this:

Code:
0 0 * * 0   rsync -a /backups/ user@host:/backups/


This will synchronize a directory called /backups/ with a /backups/ directory on a remote server every Sunday morning at 12AM.

The trailing slashes are important, I learned that the hard way. I'd encourage you to check out the man page on rsync to see all the options that are available. For general purpose synchronization I like to use the -a flag. You can also use --delete-after to remove any files on the remote server that have also been removed form the local client.

I hope this helps!


Top
 Profile YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 64 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP