一个脚本从git上pull 并更新到服务器
2017-10-17 09:45
399 查看
#/bin/bash cd /src/pid01-beta/ echo "update pid01.." git pull if [ $? -ne 0 ]; then echo "update pid01(clientErrorCode.json) from git failed" exit 1 fi res=`git pull|grep -c "up-to-date"` if [ $res -eq 1 ]; then echo "pid01 already latest,quit update" exit 1 fi go build if [ $? -ne 0 ]; then echo "go build failed" exit 1 fi rm -rf /data/wesite/pid01-beta if [ $? -ne 0 ]; then echo "delete old pid01 file failed" exit 1 fi mv /src/pid01-beta/pid01-beta /data/website/ if [ $? -ne 0 ]; then echo "move new pid01 file failed" exit 1 fi pidno=`ps aux|grep pid01|grep -v "grep"|awk '{print $2}'` kill -9 $pidno if [ $? -ne 0 ]; then echo "old pid01 kill failed" exit 1 fi sleep 5 pid01pid=`ps aux|grep pid01|grep -v "grep"|awk '{print $2}'` if [ "$pid01pid" ];then echo "new version pid01 is running now" fi
相关文章推荐
- git pull命令将git服务器的文件更新到本地
- 使用Linux定时脚本更新服务器的git代码
- 如何解决更新被拒绝,因为远程版本库包含您本地尚不存在的提交。这通常是因为另外 提示:一个版本库已向该引用进行了推送。再次推送前,您可能需要先整合远程变更 提示:(如 'git pull ...')。
- 如何解决更新被拒绝,因为远程版本库包含您本地尚不存在的提交。这通常是因为另外 提示:一个版本库已向该引用进行了推送。再次推送前,您可能需要先整合远程变更 提示:(如 'git pull ...')。
- Git pull 和fetch merge的区别, 单独更新某一个文件
- git更新服务器地址Mac版sourceTree问题
- 【shell实例】一键自动化pull->更新文件->commit->压缩打包->上传服务器
- git 如何新建一个服务器分支
- 做了一个简易的git 代码自动部署脚本
- git 上传更新的代码到服务器
- 造了一个轮子,用于服务器更新和备份文件
- Git同步它人的远程仓库至自己的Git服务器 并自动定时更新
- 第三方git pull免密码更新
- 通过Git WebHooks+脚本实现自动更新发布代码
- 一个git自动merge .pbxproj的脚本
- IIS网站问题-内部服务器错误-没有权限查看该目录或页-必须使用一个可更新的查询
- 1.shell脚本修改多台服务器上的某一个文件中的值。
- linux上用git命令上传更新代码至f服务器
- 分享一个实用的脚本,通过ftp协议传输asterisk生成的录音到单独的录音存储服务器上
- (git fetch git push git pull)远程本地分支互相推送更新