手机
当前位置:查字典教程网 >脚本专栏 >linuxshell >一键备份gitolite服务器的Shell脚本
一键备份gitolite服务器的Shell脚本
摘要:运行一次就能够把gitolite服务器上的仓库备份到本地.第一次运行会创建远程仓库的本地镜像,以后每次运行会把本地镜像更新.本程序只支持ss...

运行一次就能够把gitolite服务器上的仓库备份到本地. 第一次运行会创建远程仓库的本地镜像, 以后每次运行会把本地镜像更新.

本程序只支持 ssh方式

其他的git server貌似不会在 ssh git@xxx 的时候返回repo列表, 所以只能手动备份.

#!/bin/sh server=serv_addr root_dir=`pwd` echo "whill back in dir: ${root_dir}" ssh "git@${server}" | awk '{print $1$2,$3}' | grep "^RW" | awk '{print $2}' | while read line do echo " " echo "-------------------------------------" if [ ! -d "${root_dir}/${line}.git" ]; then echo "repo not init on local, init it ..." mkdir -p "${root_dir}/${line}.git" cd "${root_dir}/${line}.git" cd .. git clone --mirror "git@${server}:${line}.git" else echo "repo already init on local, update it ..." cd "${root_dir}/${line}.git" git remote update git gc fi done

【一键备份gitolite服务器的Shell脚本】相关文章:

监控php-fpm并自动重启服务的shell脚本

linux批量备份服务器配置文件和目录的脚本

linux下自动备份MySQL数据并上传到FTP上的shell脚本

5个实用的shell脚本面试题和答案

一个简单的转换输出的shell脚本代码

备份网站内容的shell脚本代码

两个备份数据库的shell脚本

后台实时分流文件的shell脚本

消耗CPU资源的shell脚本

获取两个日期间隔时间的shell脚本代码

精品推荐
分类导航