My configuration:
A is the service side
B is client
For A and B configuration please refer to Rsync+ssh
Because Rsync uses SSH channels, the service side of rsync is not required to be configured or started, and Rsync uses the port where SSH is in transit.
I wrote the script on the A end.
#! /bin/bash
host1=192.168.2.81
Src=/data/crash
St1=/data/crash
User=root
/usr/local/bin/inotifywait-mrq--timefmt '%d/%m/%y%h:%m '--format '%T%w%f%e '-e modify,delete,create,attrib $src \
| While read files
Do
/USR/BIN/RSYNC-VZRTOPG--delete--progress $src-e ssh [email protected] $host 1: $DST 1
echo "${files} was rsynced"
Done
Function: Synchronizes the files under the end of a/data/crash to the 192.168.2.81/data/crash
This article is from the "is Wayward" blog, please be sure to keep this source http://9756063.blog.51cto.com/9746063/1604097
Rsync +inodify for file synchronization