Rsync + inotify for real-time server backup

Source: Internet
Author: User
Tags inotify

Rsync + inotify for real-time server backup

Inotify:

Inotify is integrated into the kernel. inotify is used as a third-party software to monitor directory changes through the interfaces provided by the kernel.

The inotifywait command can monitor fine-grained real-time changes to files in the directory. The monitored command is

Inotifywait-mrq -- timefmt '% d/% m/% y % H: % m' -- format' % T % w % f % e'-e modify, delete, create, attrib/var/web

Execute this command, and the listening will always be run on the command interface. When the directory changes, the command will output the changed content. Then, use rsync to synchronize directories.

Rsync uses two working modes for synchronization, one is based on the ssh service for synchronization, use method: rsync [option] src user @ host: dir

The second method is rsync Socket mode. Use the rsync service to synchronize rsync [option] src rsync: // user @ host/web.

Inotify + rsync monitors local data changes. The server is installed on the machine to be synchronized.

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.