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 ...
随机推荐
- ubuntu14.04下 Android虚拟机 genymotion 的下载和安装
官网:https://www.genymotion.com/ Install Guide https://www.genymotion.com/#!/developers/user-guide#ins ...
- directUI
MFC界面开发中,习惯了使用控件,亦或者是自绘制控件来美化界面,但操作起来繁琐,还不太美观.DirectUI的出现,对于界面开发,给了我们一个新的选择,目前很多公司使用了该技术对其产品进行了美化,效果 ...
- java的Arrays类的应用
(2012-08-01 14:48:27) 转载▼ 标签: java arrays类 填充 排序 查找 比较数组 分类: java基础 java.util.Arrays类能方便地操作数组,它提供的所有 ...
- GHOST还原
整理日: 2015年2月16日 GHOST GHO2Disk STEP01 STEP02 STEP03 STEP04 STEP05 STEP06 STEP07
- Zoj 3868 GCD Expectation
给一个集合,大小为n , 求所有子集的gcd 的期望和 . 期望的定义为 这个子集的最大公约数的K次方 : 每个元素被选中的概率是等可能的 即概率 p = (发生的事件数)/(总的事件数); 总的事件 ...
- Initializing Spring root WebApplicationContext
最近 我部署ssh项目的时候经常出现这样的问题,我的解决办法是 log4j:WARN No appenders could be found for logger (org.springframewo ...
- EditText的 焦点事件 setOnFocusChangeListener
实现代码: //光标处在EditText时其内容消失 mInfo = (EditText)findViewById(R.id.old_password); //setOnFocusChangeList ...
- Android日志框架darks-logs使用教程
一.配置文件 在使用darks-logs之前,我们需要为它创建一个名叫logd.properties的配置文件.如果你是需要在JAVA或WEB上使用该组件,那么你可以像配置log4j一样将它放在cla ...
- 使用 ext3grep 恢复数据试验成功 笔记
使用 ext3grep 恢复数据试验成功 笔记 来源: Linux论坛 日期: 2009.07.07 10:03 (共有条评论) 我要评论 [Copy to clipboard] [ - ...
- OA系统配置文件
第一章 web.xml配置文件解读 1. web.xml文件解读 lemon OA系统的核心配置文件都放在spring目录下的具有applicationContext的前缀文件.Classpath后有 ...