INOTIFY+RSYNC+MUTT+MSMTP implement Linux file or directory automatic Update

Source: Internet
Author: User
Tags inotify log rsync

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.