|
@@ -25,6 +25,7 @@ fi
|
|
|
# 执行打包为zip
|
|
|
node ./scripts/zip.js
|
|
|
|
|
|
+current_time=$(date "+%Y%m%d%H%M%S")
|
|
|
|
|
|
# 上传到测试服务器
|
|
|
function testServer() {
|
|
@@ -35,7 +36,6 @@ function testServer() {
|
|
|
\"*password\" {set timeout 500;send \"${passwd}\r\";}
|
|
|
}
|
|
|
expect eof"
|
|
|
-
|
|
|
#服务器上的相关操作
|
|
|
/usr/bin/expect << EOF
|
|
|
set time 30
|
|
@@ -57,6 +57,10 @@ function testServer() {
|
|
|
expect "*]#"
|
|
|
send "unzip -o ${file_name}\r"
|
|
|
|
|
|
+ # 备份当前文件
|
|
|
+ expect "*]#"
|
|
|
+ send "cp ./${file_name} ./backup/${current_time}_${file_name}\r"
|
|
|
+
|
|
|
# 退出
|
|
|
send "exit\r"
|
|
|
expect eof
|
|
@@ -68,8 +72,6 @@ EOF
|
|
|
# 上传到测试服务器
|
|
|
if [ $2 == "test" ]; then
|
|
|
testServer
|
|
|
-elif [ $2 == "prod" ]; then
|
|
|
- echo "暂不支持自动部署到正式服务器上,如有需求,请手动上传到正式服务器上更新"
|
|
|
else
|
|
|
echo "编译完成"
|
|
|
fi
|