gitlab 同步小脚本

gitlab 是公司中的代码仓库,如何保证两台机器同步呢

公司中使用的是docker那么久使用docker进行演示了也方便以后的工作查找资料

附:脚本

#!/bin/bash
docker stop gitlab01
echo `date +"%F %T"` "gitlab开始从sourceIP到removeIP同步">/tmp/rsync4gitlab01.log
sleep 15
/usr/bin/rsync -avzP --delete  /hwdata/gitlab/ IP::gitlab01 >>/tmp/rsync4gitlab01.log
if [ $? -eq 0 ];then

        echo `date +"%F %T"`  "rsync同步成功">>/tmp/rsync4gitlab01.log
        docker start gitlab01
        if [ $? -eq 0 ];then
                echo `date +"%F %T"` "docker 启动成功" >>/tmp/rsync4gitlab01.log

        else
                echo `date +"%F %T"`  "docker 启动失败">>/tmp/rsync4gitlab01.log
        fi
else
        echo `date +"%F %T"` "rsync同步失败">>/tmp/rsync4gitlab01.log
fi
mail -s "gitlab备份消息推送" [email protected]  </tmp/rsync4gitlab01.log

  

gitlab 备份

时间: 2024-07-31 09:19:11

gitlab 同步小脚本的相关文章

Shell进行MySQL表跨服务器增量更新同步小脚本

工作所需写的小脚本. # !/bin/bash # Author : 蛙鳜鸡鹳狸猿# create_ts : 2017年 01月 03日 星期二 14:48:14 CST# program : Incremental transfer table records between MySQL servers# crontab : 11/min# # # __init__ host_src=yourht_A # source db server config listuser_src=rootpsw

少量文件实时同步小脚本

#!/bin/bashsrc=/xxx/xxx  #本地监控目录des_ip="192.168.1.2 192.168.1.3"  #目标服务器/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' \--exclude "\.swp$" \--exclude=/backup/ \-e close_write,modify,delete,create,attrib,m

Windows下自动同步文件的小脚本

分享两个自己整理的在windows下自动定时同步文件的bat小脚本 (照猫画虎 o(∩_∩)o ) ******************************************************************* @echo off color 02 rem 使用goto和lftp来实现定时自动上传文件到ftp服务器指定目录         ##注释信息 :loop echo.   echo.   echo =================================

shell脚本第四篇——常用小脚本

shell脚本第四篇--常用小脚本 1.将系统进程按内存占用大小排列显示出来 # ps -e  -o "%C   : %p : %z : %a"|sort -k5-nr 2.将系统进程按CPU占用大小排列显示 # ps -e  -o "%C   : %p : %z : %a"|sort   -nr 或# ps aux --sort -rss 3.查找当前目录下占用为0字节的文件并删除 # find ./ -type f -size 0 -exec rm -rf {}

百度搜索小脚本

最近在提高自己编程能力,拿一些现实的小脚本练下.该脚本为python语言,主要涉及模块urllib,和正则表达式. 功能:输入要查询的关键字,和查询条数,会返回关键字的百度搜索结果的url和条数,一次最多查50条. import urllib.request import urllib.parse import re while True: x = input("请输入需要搜索的关键字(输入"q!"退出程序):") if x == 'q!': print('bye!

一个根据内存使用情况重启tomcat的小脚本

有一台服务器上部署了tomcat,随着时间的推移,内存消耗越来越大,所以写了一个小脚本配合crontab定时检测内存,不足的情况下重启tomcat. #!/bin/bash #tomcat restart:out of memory LOG=./restart_tomcat.log TOMCAT=/tomcat/bin/ TOMCATDIR=/tomcat echo"----------------------------" >> $LOG mem_total=$(free

一个计算的小脚本

[[email protected] cailu]# cat urfile 1 a2 b3 a1 d[[email protected] cailu]# awk '{a[$1]=a[$1]?a[$1]OFS$2:$2}END{for(i in a)print i,a[i]}' urfile 1 a d2 b3 a 一个计算的小脚本,布布扣,bubuko.com

写一个php小脚本辅助渗透测试

因为一个注入要爬行一些数据,然后写的一个小脚本,能写脚本来辅助渗透,也算是里程碑.哈哈哈 <?php $num = 1; while ($num <= 39) { $web_url = "http://www.xxx.com/shownews.asp?id=626%0AUNION%0ASELECT%0Atop%0A1%0A1,user_username,3,user_password,5,6%0Afrom%0A(select%0Atop%0A1%0Auser_username,use

小脚本标签的应用

<%@include  %> 示例:在a.jsp中,有小脚本 <%@include file="/b.jsp"  %> 代表翻译阶段a和b翻译成同一个文件,小脚本的方法都在servers文件里,如果a.jsp和b.jsp都用jsp高级模板的话,都有basePath, 运行a.jsp,会和b.jsp翻译成同一个文件,会有两个路径,就会出现路径重复的错误