add rsync to 2.100 for backup

This commit is contained in:
CsHeng
2017-09-18 12:06:44 +08:00
parent 400bdaa6f5
commit 5acf42423e
5 changed files with 47 additions and 1 deletions

1
scripts/.rsyncenv Normal file
View File

@ -0,0 +1 @@
REMOTE_DIR=chenshuoheng@192.168.2.100:/app/halo/

2
scripts/.rsyncignore Normal file
View File

@ -0,0 +1,2 @@
# git ignore style
.DS_Store

21
scripts/rsync_backup.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# *****************************************************************************
# @author CsHeng
# @2017.9.14 init
#
# 简单禁用tinker标志位
#
#
# *****************************************************************************
# get current shell absolute dir
CWD=$(cd "$(dirname "$0")"; pwd)
source ${CWD}/tinker_env.sh
# sample .rsyncenv file content: REMOTE_DIR=chenshuoheng@192.168.2.100:/app/halo/
REMOTE_DIR=`grep -r REMOTE_DIR ${CWD}/.rsyncenv | awk -F '=' '{print $2}'`
echo "syning ${APP_RELEASE_ALL} to ${REMOTE_DIR}"
# 根目录是脚本文件所在的上一级
rsync --exclude-from=${CWD}/.rsyncignore -e 'ssh -p 32200' -rctvO ${APP_RELEASE_ALL} ${REMOTE_DIR}

21
scripts/rsync_retrieve.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# *****************************************************************************
# @author CsHeng
# @2017.9.14 init
#
# 简单禁用tinker标志位
#
#
# *****************************************************************************
# get current shell absolute dir
CWD=$(cd "$(dirname "$0")"; pwd)
source ${CWD}/tinker_env.sh
# sample .rsyncenv file content: REMOTE_DIR=chenshuoheng@192.168.2.100:/app/halo/
REMOTE=`grep -r REMOTE_DIR ${CWD}/.rsyncenv | awk -F '=' '{print $2}'`
echo "retrieving from ${REMOTE} to ${APP_RELEASE_ALL}"
# 根目录是脚本文件所在的上一级
rsync --exclude-from=${CWD}/.rsyncignore -rctvOe 'ssh -p 32200' ${REMOTE} ${APP_RELEASE_ALL}

View File

@ -20,7 +20,8 @@ GRADLE_FILE=${PROJECT_BASE}/gradle.properties
VERSION_NAME=`grep -r versionName ${PROJECT_BASE}/dependencies.gradle | awk -F '\"' '{print $2}'`
VERSION_CODE=`grep -r versionCode ${PROJECT_BASE}/dependencies.gradle | awk '{print $4}'`
APP_RELEASE_BASE=${PROJECT_BASE}/release-app/${VERSION_NAME}_${VERSION_CODE}
APP_RELEASE_ALL=${PROJECT_BASE}/release-app/
APP_RELEASE_BASE=${APP_RELEASE_ALL}/${VERSION_NAME}_${VERSION_CODE}
# apk应该以tinker打基准包的那个apk为准找出文件名包含flavor publish 的apk
#APP_RELEASE_FILE=${PROJECT_BASE}/release-app/${versionName}_${versionCode}/patch/app-xxxxxx-gitsha/app-publish-release.apk