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

link|improve this question

feedback

2 Answers

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)

link|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
feedback

rsync is a good way of doing this

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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