When server B (172.17.166.11) is powered on or restarted, it will automatically pull all the files in the specified directory on server A (172.17.166.10) 1. Create mutual trust between server B and server A
2. On Server B Create the following directory structure [root@w-11 home]# tree shell shell ├── logs ----directory └── pull_170.sh ----script The script is as follows: #!/bin/bash #pull_ #author:whz #date:20200805 #The non-existent variable terminates the script execution set -o nounset # Execution error terminates script execution set -o errexit # define restricted path PATH="/bin:/usr/bin:/sbin:/usr/sbin" # adirname - return absolute dirname of a given file adirname() { odir=`pwd`; cd `dirname $1`; pwd; cd "${odir}"; } MYNAM=`basename "$0"` MYDIR=`adirname "$0"` MYLOG_PATH="${MYDIR}/logs" MYLOG="${MYLOG_PATH}/${MYNAM}_`date +%F`.log" echo "`which rsync` -avtW --progress --delete [email protected]:/home/iis/ /home/iis/" >> ${MYLOG} `which rsync` -avtW --progress --delete [email protected]:/home/iis/ /home/iis/ >> ${MYLOG} exit 0 3. Crontab plan on server B
That’s it, done. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Summary of knowledge points about covering index in MySQL
1. Why do packaging? Facilitates overall code cal...
What to do if you forget your Linux/Mac MySQL pas...
When using the MySQL database, if you have not lo...
Table of contents How to create a Pod? kubectl to...
1. Go to the location where you want to store the...
1. Use the SELECT clause to query multiple tables...
When we want to add a shadow to a rectangle or ot...
Logo optimization: 1.The logo image should be as ...
1. Overview The image in Docker is designed in la...
Preface This article mainly introduces the releva...
Table of contents Preface iframe implements sandb...
This article shares the specific code of jQuery t...
Table of contents Impact of full table scan on th...
This article shares a small example of adding and...
Table of contents 1. Nodes, trees, and virtual DO...