Data end: to write scripts, upload the installation package, and backup end do no secret visit
Backup end: Create a backup storage directory
Script content
#!/bin/bash
inotifywait -mrq -e create,move,delete,modify /var/www/html/ | while read a b c
do
rsync -azP --delete /var/www/html/ [email protected]:/web-back
done
Script add execute permissions, background, (note the user name, directory path, backup path)
installation
[root@xuegod63 ~]# tar -zxvf inotify-tools-3.13.tar.gz
[root@xuegod63 ~]# cd inotify-tools-3.13
[root @ xuegod63 inotify-tools- 3.13] # ./configure check the installation environment
[@ xuegod63 the inotify the root-Tools-3.13] # the make -j. 4 #make compile the source code into binary, executable files, source compiler mysql or cores: the make -j. 4 fast.
[root@xuegod63 inotify-tools-3.13]# make install # 安装
inotifywait
-e to specify which events you want to monitor.
These events include: the Create create, move move, delete delete, modify modify the contents of the file , attrib property changes.
-m represents the continuous monitoring
-r recursive represent the entire directory
a simplified information outputted -q