rsync 推送
两遍服务器都安装好rsync后 如果做推送服务 被推送的服务器的 配置文件 注意事项
1服务端(192.168.1.241)配置的密匙文件 格式为【运行环境】
用户名:密码
root:123456
2 客户端(192.168.1.240)配置的密码文件[git代码托管]
密码
123456
客户端测试推送到服务器端
rsync -vzrtopg --delete --progress --password-file=/etc/rsyncd/rsyncd.secrets /var/opt/gitlab/git-data/gitlab-satellites/ranmufei/linksame/ root@192.168.1.241::linksame
环境服务器上面有两个 模块
(1) linksame
(2) apps
inotufy 及时监控git代码修改 并推送到 服务器
/usr/local/inotify/rsync.sh
#!/bin/sh
srcdir=/var/opt/gitlab/git-data/gitlab-satellites/ranmufei/linksame/ #源服务器地址
dstdir=linksame #241 目标服务器
rsyncuser=root #目标服务器用户名
rsyncpassdir=/etc/rsyncd/rsyncd.secrets #目标服务器密码
dstip="192.168.1.241" #目标服务器ip
for ip in $dstip
do
rsync -avH --port=873 --progress --delete $srcdir $rsyncuser@$ip::$dstdir --password-file=$rsyncpassdir
done
/usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e close_write,modify,delete,create,attrib,move $srcdir | while read file
do
for ip in $dstip
do
rsync -avH --port=873 --progress --delete $srcdir $rsyncuser@$ip::$dstdir --password-file=$rsyncpassdir
echo " ${file} was rsynced" >> /tmp/rsync.log 2>&1
done
done
启动
#nohup /bin/bash /root/rsync.sh &
开机自启动
#echo "nohup /bin/bash /root/rsync.sh &" >> /etc/rc.local
监听本机多个文件夹下的文件单独创建监听文件 加入开机启动即可
#!/bin/sh
srcdir=/var/opt/gitlab/git-data/gitlab-satellites/ranmufei/linksame/ #源服务器地址
srcdir2=/var/opt/gitlab/git-data/gitlab-satellites/ranmufei/apps/ #源服务器地址
dstdir=linksame # 目标服务器
dstdir2=apps # 目标服务器
rsyncuser=root #目标服务器用户名
rsyncpassdir=/etc/rsyncd/rsyncd.secrets #目标服务器密码
dstip="192.168.1.241" #目标服务器ip ##################linksame###############
rsync -avH --port= --progress --delete $srcdir $rsyncuser@$dstip::$dstdir --password-file=$rsyncpassdir /usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e close_write,modify,delete,create,attrib,move $srcdir | while read file
do rsync -avH --port= --progress --delete $srcdir $rsyncuser@$dstip::$dstdir --password-file=$rsyncpassdir
echo " ${file} was rsynced" >> /tmp/rsync.log >& done
一键安装包 服务器端 并没有安装git命令 如果要在服务器上面使用git 请单独安装 git
yum install -y git
参考
http://www.osyunwei.com/archives/7435.html
rsync 推送的更多相关文章
- rsync推送和拉取
rsync格式: # 拷贝本地文件.当SRC和DES路径信息都不包含有单个冒号":"分隔符时就启动这种工作模式.如:rsync -a /data /backup rsync [OP ...
- rsync推送备份服务器(Linux)
rsync推送备份服务器备份服务器操作需被备份的服务器操作批处理shell备份服务器操作#编辑配置文件vi /etc/rsyncd.conf uid = root #运行RSYNC守护进程的用户gid ...
- rsync 系统用户/虚拟用户 备份web服务器数据及无交互定时推送备份
一.服务环境 (1),WEBserver(192.168.10.130) : BACKserver(192.168.10.129) (2),BACKserver服务器部署,安装所需软件,并启动 (3) ...
- 【NFS项目实战二】NFS共享数据的时时同步推送备份
[NFS项目实战二]NFS共享数据的时时同步推送备份 标签(空格分隔): Linux服务搭建-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品, ...
- 使用git或TortoiseGit推送项目至gitlab
一.Wins安装Git+Trtoisegit工具实现版本克隆与推送 Git: https://git-scm.com/ Tortoisegit: https://tortoisegit ...
- 博客搬家 - 记第四次搬家(hugo建站推送到谷歌云存储)
写在前面,搬迁记录 记录我的博客这次搬家过程.我的博客之前经历过: wordpress github page Bitcron - 机制很不错(写完的博客自动保存到dropbox并发布,可惜搜索引擎的 ...
- 在Openfire上弄一个简单的推送系统
推送系统 说是推送系统有点大,其实就是一个消息广播功能吧.作用其实也就是由服务端接收到消息然后推送到订阅的客户端. 思路 对于推送最关键的是服务端向客户端发送数据,客户端向服务端订阅自己想要的消息.这 ...
- iOS---iOS10适配iOS当前所有系统的远程推送
一.iOS推送通知简介 众所周知苹果的推送通知从iOS3开始出现, 每一年都会更新一些新的用法. 譬如iOS7出现的Silent remote notifications(远程静默推送), iOS8出 ...
- SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=》提升)
SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=>提升,5个Demo贯彻全篇,感兴趣的玩才是真的学) 官方demo:http://www.asp.net/si ...
随机推荐
- destoon代码从头到尾捋一遍
destoon® B2B网站管理系统(以下简称destoon)由西安嘉客信息科技有限责任公司独立研发并推出,对其拥有完全知识产权,中国国家版权局计算机软件著作权登记号:2009SR037570. 系统 ...
- PHP扩展Redis编译安装
PHP扩展Redis编译安装 1.下载PHP官方Redis源码包 wget http://pecl.php.net/get/redis-2.2.4.tgz 注:我用的是Redhat系统,ubunt ...
- ng-form
form提供的属性都是用来表示表单的验证状态的,包括:$pristine(表单没有填写记录).$dirty(表单有填写记录).$valid(通过验证).$invalid(未通过验证).$error(验 ...
- thinkphp路径引用问题
查看ThinkPHP\Library\Behavior\ContentReplaceBehavior.class文件,常量定义如下定义: '__ROOT__' => __ROOT__ ...
- 工具批处理Demo
前言:用C语言写一些小型工具时,使用传递参数的方式会比较方便.如GIF文件转换为头文件工具,如果我们需要将某一个文件夹里所有的gif文件都转换为头文件,这时我们用批处理给这个工具传递参数,会方便很多. ...
- maven web项目不能创建src/main/java等文件夹的问题
eclipse创建maevn web项目,在选择maven_archetype_webapp原型后,默认只有src/main/resources这个Source Floder. 按照maven目录结 ...
- 获取网络图片的大小 改变 图片色值 灰度什么的方法集合-b
直接上代码了 头文件 // 图片处理 0 半灰色 1 灰度 2 深棕色 3 反色 +(UIImage*)imageWithImage:(UIImage*)image grayLevelTy ...
- 关于.NET的配置文件
无论是exe文件还是dll文件,都可以添加App.config文件,里面设置配置信息.比如<appSettings></appSettings>之间,可以加入Key-Value ...
- hadoo namenode format 异常 java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
/etc/sysconfig/network换成你在hosts里设置的值 /etc/rc.d/init.d/network restart 重启网络 hostname后就会发现hostname变了,也 ...
- spoj 4487. Can you answer these queries VI (gss6) splay 常数优化
4487. Can you answer these queries VI Problem code: GSS6 Given a sequence A of N (N <= 100000) in ...