-
Notifications
You must be signed in to change notification settings - Fork 11
/
init.sh
executable file
·32 lines (24 loc) · 1.18 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# ---------------------------------------------------------------
# 初始化代码部署系统
#
# Filename: init.sh
# Copyright: (c) 2016 360 Free WiFi Team. (http:://wifi.360.cn)
# License: http://www.apache.org/licenses/LICENSE-2.0
# ---------------------------------------------------------------
# 关闭SSH-2 GSSAPI认证 & 关闭秘钥记录到known_hosts
SSH="sudo -u ${SSH_USER} ssh -o GSSAPIAuthentication=no -o StrictHostKeyChecking=no"
SCP="sudo -u ${SSH_USER} scp -o GSSAPIAuthentication=no -o StrictHostKeyChecking=no -C"
RSYNC="sudo -u ${SSH_USER} rsync"
# 所有用户: 保存本地临时文件的公共目录, 所有用户发布的代码都会保存在这里
LOCAL_CODEDEPLOY_TMP_DIR="/tmp/codedeploy_tmp/${USER}"
# 当前用户: 线上每次收到代码, bak目录地址
REMOTE_CODEDEPLOY_HISTORY_DIR="/home/${SSH_USER}/codedeploy_history/${project_name[$params_2]}"
# 所有用户: 线上记录最后一次更新的用户名称
REMOTE_CODEDEPLOY_ALLUSER_LOG="${REMOTE_CODEDEPLOY_HISTORY_DIR}/codedeploy_alluser_log"
# 部署成功的机器数量
INT_COUNT_SUCCESS=0
# 部署失败的机器数量
INT_COUNT_FAILED=0
# 部署失败的机器列表
ARR_FAILED_HOST=""