Rsync server and client configuration file the target server configuration file [rsyncd. conf] uid = nobodygid = nobodyuse chroot = nomax connections = 10 strict modes = yespid file =/var/run/rsyncd. pidlock file =/var/run/rsync. locklog file =/var/log/rsyncd. log # Module name [web1] # target server directory path =/usr/local/rubyzhu/testcomment = web1 fileignore errors = yesread only = nowrite only = nolist = falsehosts allow = 127.0.0.1hosts deny = * uid = rootgid = root # authenticated user name, Has nothing to do with the operating system user auth users = backupsecrets file =/etc/rsyncd. secrets client configuration file (monitored system) [inotify-tool.sh self-write script] #! /Bin/shsrc =/usr/local/rubyzhu/test1/# inotify monitored directory des1 = web1 # rsync server module ip1 = 127.0.0.1 # target server IP address user = backup # target server the username of rsyncr's web1 module, unrelated to the operating system user name/usr/local/bin/inotifywait-mrq -- timefmt '% d/% m/% y % H: % m' -- format' % T % w % F' \-e close_write, modify, create, attrib, delete \ $ {src} \ | while read file do rsync-avz -- delete -- progress -- password-file =/etc/server. pass $ {src }$ {user }@$ {ip1 }::: {des1} & # rsync-avz -- delete -- progress -- password-file =/etc/server. pass $ {src }$ {user }@$ {ip2 }::: {des2} & echo "$ {src} was rsynced" echo "-------------------------------------------------" done