rsync+inotify 在一台服务器上面同步数据
来源:互联网 发布:知乎app产品分析 编辑:程序博客网 时间:2024/06/05 10:46
1:rsync:负责同步数据
安装:yun install rsync
usr/bin/rsync -auvrtzopgP --progress --delete /usr/local/www/admin/html/ /usr/local/www/web/basic/web/html/
同步/usr/local/www/admin/html/ 到 /usr/local/www/web/basic/web/html/
2:inotify:负责监控文件夹是否有变化
安装:yum install inotify-tools
/usr/bin/inotifywait -mrq --timefmt '%Y/%m/%d-%H:%M:%S' --format '%T %w %f' -e modify,delete,create,move,attrib /usr/local/www/admin/html/
监控 /usr/local/www/admin/html/ 文件夹里面的删除 移动 创建
3:nohup 使用守护线程
4:编写shell脚本 rsync.sh
#!/bin/bash
log_file=/var/log/rsync_client.log
inotify_fun(){
/usr/bin/inotifywait -mrq --timefmt '%Y/%m/%d-%H:%M:%S' --format '%T %w %f' -e modify,delete,create,move,attrib /usr/local/www/admin/html/ | while read file
do
/usr/bin/rsync -auvrtzopgP --progress --delete /usr/local/www/admin/html/ /usr/local/www/web/basic/web/html/
done
}
#inotify log
inotify_fun >> ${log_file} 2>&1 &
5:启动
nohup /usr/local/www/shell/rsync.sh & 回车两次就ok
6: 停止
ps -aux |grep rsync 查看进程 然后 kill -9 进程编号
pkill rsync
pkill inotifywait
安装:yun install rsync
usr/bin/rsync -auvrtzopgP --progress --delete /usr/local/www/admin/html/ /usr/local/www/web/basic/web/html/
同步/usr/local/www/admin/html/ 到 /usr/local/www/web/basic/web/html/
2:inotify:负责监控文件夹是否有变化
安装:yum install inotify-tools
/usr/bin/inotifywait -mrq --timefmt '%Y/%m/%d-%H:%M:%S' --format '%T %w %f' -e modify,delete,create,move,attrib /usr/local/www/admin/html/
监控 /usr/local/www/admin/html/ 文件夹里面的删除 移动 创建
3:nohup 使用守护线程
4:编写shell脚本 rsync.sh
#!/bin/bash
log_file=/var/log/rsync_client.log
inotify_fun(){
/usr/bin/inotifywait -mrq --timefmt '%Y/%m/%d-%H:%M:%S' --format '%T %w %f' -e modify,delete,create,move,attrib /usr/local/www/admin/html/ | while read file
do
/usr/bin/rsync -auvrtzopgP --progress --delete /usr/local/www/admin/html/ /usr/local/www/web/basic/web/html/
done
}
#inotify log
inotify_fun >> ${log_file} 2>&1 &
5:启动
nohup /usr/local/www/shell/rsync.sh & 回车两次就ok
6: 停止
ps -aux |grep rsync 查看进程 然后 kill -9 进程编号
pkill rsync
pkill inotifywait
0 0
- rsync+inotify 在一台服务器上面同步数据
- Centos 6.5 rsync+inotify 两台服务器文件实时同步
- rsync+inotify实现多台web数据动态同步
- 两台服务器同步数据 rsync
- Centos6.3下rsync+inotify服务器数据同步(备份)
- rsync与inotify 数据同步
- rsync+inotify 进行数据同步
- 两台服务器间使用rsync和inotify-tools实现文件同步
- rsync+inotify实现多台web数据动态同步操作步骤
- rsync+inotify 配置实时同步服务器
- 多服务器文件自动同步inotify+rsync
- 服务器间同步inotify+rsync+supervisor
- 安装rsync+inotify实时同步备份服务器
- inotify+ rsync window同步linux服务器文件夹
- 利用rsync+inotify实现数据同步
- rsync与inotify实时同步备份数据
- rsync + inotify 实现单向数据同步
- Rsync + inotify 实现数据的实时同步
- 关于定时器schedule
- 第八周 项目4 字符串加密
- 担保品划转跳转页面错误(先跳出登陆界面了)
- 请求照片
- IO操作中缓冲区原理
- rsync+inotify 在一台服务器上面同步数据
- JNI 实战全面解析
- Hive Hbase Pig 区别
- lua文件读写
- CSS 基础点集锦一:盒子模型、浮动、清除浮动
- LeetCode 22: Generate Parentheses
- ffmpeg 命令 rgb565 to YUV420p
- C语言 内存管理
- Thread 线程