Copy&delete script between servers
by hatfani from LinuxQuestions.org on (#4T027)
Hey everyone,
I have 2 remote Servers running Linux centos: Server 1and Server 5.
On Server 1I have a directory named: 'Example'
I need to copy 'Example' directory from Server 1 to Server 5 and then delete 'Example' directory from Server 1 (if there's a possibility to do it by one command it would be better of course).
I would like to create a script for those actions, I saw that there are some options with scp/rsync commands.
I think that I need to set up ssh-key too so they'll do it automatically without the need of authentications all the time - would like to have more information about how do I do that.
Thank you!


I have 2 remote Servers running Linux centos: Server 1and Server 5.
On Server 1I have a directory named: 'Example'
I need to copy 'Example' directory from Server 1 to Server 5 and then delete 'Example' directory from Server 1 (if there's a possibility to do it by one command it would be better of course).
I would like to create a script for those actions, I saw that there are some options with scp/rsync commands.
I think that I need to set up ssh-key too so they'll do it automatically without the need of authentications all the time - would like to have more information about how do I do that.
Thank you!