From abd20f31b8477d3a35b641b1c9db2e6922472cf7 Mon Sep 17 00:00:00 2001 From: wojiushixiaobai <296015668@qq.com> Date: Sun, 22 Apr 2018 22:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=87=E7=BA=A7=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/upgrade.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/utils/upgrade.sh b/utils/upgrade.sh index 6e6efcb73..878bf770a 100644 --- a/utils/upgrade.sh +++ b/utils/upgrade.sh @@ -1,9 +1,20 @@ #!/bin/bash if [ ! -d "/opt/py3" ]; then -echo -e "\033[31m python3虚拟路径不正确 \033[0m" -echo -e "\033[31m 请手动修改虚拟环境的位置 \033[0m" +echo -e "\033[31m python3虚拟环境不是默认路径 \033[0m" +ps -ef | grep jumpserver/tmp/beat.pid | grep -v grep +if [ $? -ne 0 ] +then +echo -e "\033[31m jumpserver未运行,请到jumpserver目录使用 ./jms start all -d 启动 \033[0m" exit 0 +else +echo -e "\033[31m 正在计算python3虚拟环境路径 \033[0m" +fi +py3pid=`ps -ef | grep jumpserver/tmp/beat.pid | grep -v grep | awk '{print $2}'` +py3file=`cat /proc/$py3pid/cmdline` +py3even=`echo ${py3file%/bin/python3*}` +echo -e "\033[31m python3虚拟环境路径为$py3even \033[0m" +source $py3even/bin/activate else source /opt/py3/bin/activate fi @@ -37,6 +48,8 @@ fi git pull && pip install -r requirements/requirements.txt && cd utils && sh make_migrations.sh +cd .. && ./jms start all -d +echo -e "\033[31m 请检查jumpserver是否启动成功 \033[0m" echo -e "\033[31m 备份文件存放于$jumpserver_backup目录 \033[0m" exit 0