|
|
@ -1,24 +1,14 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -d "/opt/py3" ]; then
|
|
|
|
if grep -q 'source ~/.autoenv/activate.sh' ~/.bashrc; then
|
|
|
|
echo -e "\033[31m python3虚拟环境不是默认路径 \033[0m"
|
|
|
|
echo -e "\033[31m 正在自动载入 python 环境 \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
|
|
|
|
else
|
|
|
|
source /opt/py3/bin/activate
|
|
|
|
echo -e "\033[31m 不支持自动升级,请参考 http://docs.jumpserver.org/zh/docs/upgrade.html 手动升级 \033[0m"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
source ~/.bashrc
|
|
|
|
|
|
|
|
|
|
|
|
cd `dirname $0`/ && cd .. && ./jms stop
|
|
|
|
cd `dirname $0`/ && cd .. && ./jms stop
|
|
|
|
|
|
|
|
|
|
|
|
jumpserver_backup=/tmp/jumpserver_backup$(date -d "today" +"%Y%m%d_%H%M%S")
|
|
|
|
jumpserver_backup=/tmp/jumpserver_backup$(date -d "today" +"%Y%m%d_%H%M%S")
|
|
|
@ -41,7 +31,6 @@ echo -e "\033[31m 备份数据库失败,请检查输入是否有误 \033[0m"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo -e "\033[31m 备份数据库完成 \033[0m"
|
|
|
|
echo -e "\033[31m 备份数据库完成 \033[0m"
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e "\033[31m 已取消备份数据库操作 \033[0m"
|
|
|
|
echo -e "\033[31m 已取消备份数据库操作 \033[0m"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|