Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy files from one redhat server to another on a daily bases. 2

Status
Not open for further replies.

Empeethree

IS-IT--Management
Mar 27, 2000
192
US
I am a complete noob when it comes to linux. I need to copy a few folders from one server to another for backup. I have read a lot of info on how to do it, but honestly I have no clue how to go about it. If someone could give me a step by step that would be great.


thanks

--------------------------------------
Trying is the first step to failure
Homer Simpson
--------------------------------------
 
what OS is your source and target servers? Windows, Linux and UNIX work quite different and with different protocols.

Cheers.
 
first you decide how you want to copy the files. I like rsync, but you can automate ftp or scp or tar to move the files.

Then you write a script that you can run and have it work completely hands off.

Then you put it in cron to run automatically. man cron for more information.
 
sorry, both servers are redhat.

rsync seems like the way to do it, I just have no clue how to go about it.

--------------------------------------
Trying is the first step to failure
Homer Simpson
--------------------------------------
 
From man rsync:
[tt]
rsync -avz foo:src/bar /data/tmp

This would recursively transfer all files from the directory src/bar on the machine foo into
the /data/tmp/bar directory on the local machine. The files are transferred in “archive”
mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc.
are preserved in the transfer. Additionally, compression will be used to reduce the size of
data portions of the transfer.
[/tt]

 
No clue how to use rsync or how to schedule it?

To learn to use rsync read the man page and the tutorial.

To schedule it you create a file in a "crontab" format to describe when to run the rsync command. The format is a little cryptic, but basically it's something like:

0 * * * * your command goes here

That will run it at the top of every hour.

0 6 * * * command

that will run at 6am every day

"man 5 crontab" will explain it fully.

 
Well SkullandCircle, I can see that both ericbruson and me are telling you the same:

man rsync
man crontab
man 5 crontab


Cheers.
 
Here is an idea of how a line in rsync would look. I use rysnc to run my backups. All this stuff should be in one continous line:

rsync -azvb --delete --ignore-errors -exclude=pagefile.sys --exclude=*.[aA][vV][iI] server::share/ /local/share >>$(date -I).log

That line runs rsync, it delete's files that no longer exist on the main server from the second one. It ignores any errors that may stop rsync, it excludes any pagefile that exists and any avi files that exist. Then it copies from the remote machine, or in my case the primary file server share to the local redhat share that i created and then it outputs everything to a logfile with the current date and time.

Hope that helps.

Eddie Fernandez
CCNA, Network+, A+, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top