前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux rsync + inotify搭建实时网页发布同步系统

linux rsync + inotify搭建实时网页发布同步系统

作者头像
葫芦
发布2019-05-09 15:24:07
1.4K0
发布2019-05-09 15:24:07
举报
文章被收录于专栏:葫芦

WEB服务器

[root@localhost ~]# cat /etc/rsyncd.conf

#如果不加这行strict modes = false,可能会出现@ERROR: auth failed on module mysql strict modes = false #只允许192.168.1.0 网段下的客户端同步,也可指定IP。www.linuxidc.com 多个IP用逗号且无空格连接,如192.168.1.2,192.168.1.3 #也可用:hosts deny = 0.0.0.0/32 hosts allow = 192.168.0.166/32 log file = /var/log/rsyncd.log #pid file = /var/run/rsyncd.pid #指定rsync的pid文件,可不用。#motd file = /etc/rsyncd.motd #欢迎信息文件名称和存放位置(此文件没有,可以自行添加) #lock file = /var/run/rsync.lock #指定支持max connections参数的锁文件,默认值 #max connections = 10   # 最大连接数为10 [web]  #指定认证的备份模块名为mysql,在client端需要指定 #备份路径 path= /var/www #验证用户,这行如果不用,则可匿名访问,多个用户用逗号“,”分隔 #不建议用root。 auth users = wangzi #备份以什么用户ID和组ID进行,也可用root #但建议用mysql用户去读,只要设置有足够权限的用户即可,不建议用root. uid = root gid = root # 可以忽略一些无关的IO错误 ignore errors #不允许列文件 list = false #密码验证文件:username:password secrets file = /etc/rsyncd.secrets #关闭只读,可以上传 read only = no write only = no #pid file = /var/run/rsyncd.pid #log file = /var/log/rsyncd.log #lock file = /var/run/rsync.lock #trict modes = false,可能会出现@ERROR: auth failed on module mysql #只允许192.168.1.0 网段下的客户端同步,也可指定IP。www.linuxidc.com 多个IP用逗号 #motd file = /etc/rsyncd.motd #欢迎信息文件名称和存放位置(此文件没有,可以自行>添加) #lock file = /var/run/rsync.lock #指定支持max connections参数的锁文件,默认值

[root@localhost ~]# cat /etc/rsyncd.secrets ****:****

[root@localhost ~]# rsync --daemon --config=/etc/rsyncd.conf

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

发布服务器

uname -r

确认下是否内核版本高于2.6.13

安装inotify-tools

./configure

make

make install

[root@wangzi ~]# cat /var/www/inotify #!/bin/bash host1=192.168.0.166 src=/var/www/wangmai dst1=web user1=wangzi /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y' --format '%T %w%f%e' -e modify,delete,create,attrib $src \ | while read files do /usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/server.pass $src $user1@$host1::$dst1 echo "${file} was rsynced" >>/tmp/rsync.log 2>&1 done

[root@wangzi akismet]# cat /etc/exclude_wangmai.txt home/logs

[root@wangzi akismet]# cat /etc/server.pass ****

chmod 755 /var/www/inotify

nohup /var/www/inotify &

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2014/01/29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档