代码拉取完成,页面将自动刷新
同步操作将从 ly525/luban-h5 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#! /bin/sh
###
# @Author: ly525
# @Date: 2020-01-12 11:21:11
# @LastEditors : ly525
# @LastEditTime : 2020-01-12 16:30:08
# @FilePath: /luban-h5/sync2server.sh
# @Github: https://github.com/ly525/luban-h5
# @Description: script for sync source code from local to server
# @Copyright 2018 - 2019 luban-h5. All Rights Reserved
###
SOURCE_PATH=/centos/luban-h5
PEM_PATH=~/.ssh/id_rsa
# usage:
# $ ./sync2server.sh host --dry
# $ ./sync2server.sh host --source
usage() {
N=$(basename "$0")
echo "Usage: $N host [--source|--dry]" >&2
exit 1
}
if [ $# != 2 ]; then
echo $# $1 $2
usage
fi
SERVER_HOST=$1
# 正式同步
sync_source() {
echo "sync_source to $SERVER_HOST"
rsync\
-atzvhcP\
-e "ssh -i $PEM_PATH"\
--exclude "node_modules"\
--exclude "build*"\
--exclude "public"\
--exclude "dist"\
--exclude ".git"\
--exclude ".cache"\
--exclude ".DS_Store"\
--exclude "*.apk"\
--exclude "*.bak"\
--exclude "logs"\
--exclude "*.pyc"\
--exclude "local_settings.py"\
--exclude "*.swp"\
--exclude "*.md"\
--exclude "sync.sh"\
--exclude ".idea"\
--exclude ".vscode"\
--exclude "*.db"\
--exclude "db.sqlite3"\
--exclude "vagrant"\
./* centos@$SERVER_HOST:$SOURCE_PATH
}
#!zh: 正式同步代码前的试运行,不会真正同步代码,主要用来检测本地和服务器代码有哪些不同
#!en: dry run before sync code
sync_sourcedryrun() {
echo "sync_source to $SERVER_HOST"
rsync\
-atzvhncP\
-e "ssh -i $PEM_PATH"\
--exclude "node_modules"\
--exclude "dist"\
--exclude "build*"\
--exclude "public"\
--exclude ".DS_Store"\
--exclude ".git"\
--exclude ".cache"\
--exclude "*.apk"\
--exclude "*.bak"\
--exclude "logs"\
--exclude "*.pyc"\
--exclude "local_settings.py"\
--exclude "*.swp"\
--exclude "*.md"\
--exclude "sync.sh"\
--exclude ".idea"\
--exclude ".vscode"\
--exclude "*.db"\
--exclude "db.sqlite3"\
--exclude "vagrant"\
./* centos@$SERVER_HOST:$SOURCE_PATH
}
case "$2" in
--source)
sync_source
;;
--dry)
sync_sourcedryrun
;;
*)
usage
;;
esac
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。