Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have server 1 and Server 2.

In step one there is one script running in server1 that generates one file, after the process of creating the file is finish I need to upload the file to Server 2.

What is the best method and approach?

Thanks, Pedro

share|improve this question

2 Answers 2

up vote 2 down vote accepted

There are multiple ways to transfer files in linux. The most common and simples way is scp:

scp [[username@]host:]file-to-copy [[username@]host:]target

[]- marks optional arguments. If you for example is login in to server 1 you could do:

scp file-to-copy server2:/location/to/put/the/file/in

or if you need a different username on server2, change server2 to username@server2

If you which to have some more advanced features, like syncing and only copying new files, take a look at rsync (checkout man rsync)

share|improve this answer
    
Assumes sshd (package openssh-server) running on the target machine. –  ysth Aug 3 '09 at 9:01
    
Ah, yes. Thank you, forgot that it is not installed per default in ubuntu. –  Torandi Aug 3 '09 at 9:26
    
Don't forget keypairs without passwords allow you to copy without prompts etc. Making it easy to script. help.ubuntu.com/community/SSH/OpenSSH/Keys help.ubuntu.com/8.04/serverguide/C/openssh-server.html –  Haakon Aug 3 '09 at 11:42

rsync is a good way of doing this

share|improve this answer

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.