Server 1 is connected to server 2 via SSH.
We know this: I can execute a command such as
"ssh server2" cp -rv / var / www / tmp ""
Which will copy the / var / www dir to / tmp even though we have the following structure (sample LS output below) within / var / www
$ ls
/ web1 / web2 / web3 file1. Php file2.php file3.php
How can I execute a CP command which is / web 1, / web 3, file 1 PHP and file3 PHP (Clearly just copying Web 2 and File 2 is not an option because it has a lot of files in comparison to just 6)
Note: I want to do it for Server2 Backup before RSYNCing from Server2 I am using.
There are good suggestions about both of the first two posters here, there is a complete complete understanding of the process.
(1) If you want to backup server 2 before synchronizing with server 1, do so with rsync
. This command is seen from server 1 (assuming he has access to server 2):
ssh user @ server2 "rsync $ RSYNC_OPTS / var / www / / path / to / Backup " (2) With backing up server 2, now synchronize with 1 server (again, as seen from server 1)
rsync $ RSYNC_OPTS / path / to / www / user @ server2: / var / www /
Unless you use the intelligent RSYNC_OPTS
Until then, backup and sync should be appropriate. Richard had a reasonable suggestion for options:
RSINNCPOS = "- out-rsync-exclude.txt --stats -avz --numeric-ids -e ssh"
If you want an accurate reproduction, then I will also recommend - delete / code> or - delete-after
Comments
Post a Comment