|
|
|
@ -161,10 +161,11 @@ deployPull() { |
|
|
|
|
|
|
|
deployServer() { |
|
|
|
pid=$1 |
|
|
|
start=$2 |
|
|
|
deployPull |
|
|
|
buildCode |
|
|
|
echo "###--代码构建完成--------------------------------------------------------------------------###" |
|
|
|
# 重启服务 |
|
|
|
# 停止服务 |
|
|
|
if [ ! -z $pid ];then |
|
|
|
stopServer $pid |
|
|
|
sleep 8s |
|
|
|
@ -177,7 +178,10 @@ deployServer() { |
|
|
|
echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix" |
|
|
|
cp -r ./ ../runtime |
|
|
|
echo "" |
|
|
|
# 启动服务 |
|
|
|
if [ "$start" == "start" ];then |
|
|
|
startServer |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
restartServer() { |
|
|
|
@ -199,16 +203,19 @@ deployYvanUI() { |
|
|
|
} |
|
|
|
|
|
|
|
pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'` |
|
|
|
# 操作参数: pull deploy restart start stop kill log logs |
|
|
|
# 操作参数: pull build deploy restart start stop kill log logs |
|
|
|
if [ "$cmd" == "pull" ];then |
|
|
|
deployYvanUI |
|
|
|
deployPull |
|
|
|
if [ -z $pid ];then |
|
|
|
echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs" |
|
|
|
echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs" |
|
|
|
fi |
|
|
|
elif [ "$cmd" == "build" ];then |
|
|
|
deployYvanUI |
|
|
|
deployServer $pid "no_start" |
|
|
|
elif [ "$cmd" == "deploy" ];then |
|
|
|
deployYvanUI |
|
|
|
deployServer $pid |
|
|
|
deployServer $pid "start" |
|
|
|
elif [ "$cmd" == "restart" ];then |
|
|
|
restartServer $pid |
|
|
|
elif [ "$cmd" == "start" ];then |
|
|
|
@ -219,9 +226,10 @@ elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then |
|
|
|
logs |
|
|
|
else |
|
|
|
if [ -z $pid ];then |
|
|
|
echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs" |
|
|
|
echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs" |
|
|
|
echo "查看日志: tail -F $logPath -n 100" |
|
|
|
else |
|
|
|
echo "输入操作参数: pull deploy restart start stop kill log logs" |
|
|
|
echo "输入操作参数: pull build deploy restart start stop kill log logs" |
|
|
|
echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|