INOTIFY+RSYNC+MUTT+MSMTP implement Linux file or directory Automatic Update and implement email to admin
 
Implement real-time synchronization of files and monitor directory to send mail to admin
 
requirements, need to update multiple servers, manual, long time.
 
and real-time monitoring to send mail to the administrator's mailbox.
 
Server architecture Diagram
 
 
 
Update Source ip:192.168.0.110
 
Server ip:192.168.0.185
 
192.168.0.185 Configuration
 
First install Rsync
 
Yum-y Install Rsync
 
and wait.
 
Define rsync configuration file/etc/rsyncd.conf directly write a shell script
 
#!/bin/bash
 
Cat >>/etc/rsyncd.conf << EOF
 
UID = nobody
 
GID = Nobody
 
Use chroot = no
 
Max connections = 100
 
Timeout = 600
 
PID File=/var/run/rsyucd.pid
 
Lock file =/var/run/rsyncd.lock
 
Log file =/var/log/rsyncd.log
 
[Static]
 
Path = Update directory address
 
Ignore errors
 
Read Only = no
 
List = no
 
Hosts allow = 192.168.0.0/255.255.255.0
 
Auth users = WWW1
 
Secrets file =/etc/www1.pwd
 
Eof
 
/etc/rsyncd.conf Actually, it's okay to modify it directly.
 
And then run