Background introduction:
The company's file server has multiple, one master server and 10 or so slave servers.
When files in the master server are updated, the files in the slave server must also do the corresponding synchronization operations.
The company is currently using Rsync synchronization, but synchronization time is inconsistent, so when the server update, it is necessary to manually synchronize each slave server.
To automate this step, you have the following script:
@echo off
echo Rsync 10.10.0.100 (server1)...
plink 10.10.0.100 -l root -pw server1Passwd rsync -avzP --password-file=/etc/rsync.password [email protected]10.10.0.1::down /home/website.com/public_html
echo .
echo Rsync 10.10.0.101 (server2)...
plink 10.10.0.101 -l root -pw server2Passwd rsync -avzP --password-file=/etc/rsync.password [email protected]10.10.0.1::down /home/website.com/public_html
echo .
echo Rsync 10.10.0.102 (server3)...
plink 110.10.0.102 -l root -pw server3Passwd rsync -avzP --password-file=/etc/rsync.password [email protected]10.10.0.1::down /home/website.com/public_html
echo .
pause
Configuration Description:
Rsync.password: Is the password file used by the Rsync client
Downsync: Is the sync account that is allowed on the rsync server side
Putty Official Website: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Note: When the above command executes, use Plink.exe, please put the script and Plink.exe in the same folder to execute
Using putty to perform the rsync command