From fd323c20e179a0e616acaf226d42565bf1b5f2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=8F=E7=99=BD?= <296015668@qq.com> Date: Thu, 22 Dec 2022 14:27:13 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=9B=B4=E6=96=B0=20celery=20=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/check_celery.sh | 11 ++++++----- utils/upgrade.sh | 45 ------------------------------------------- 2 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 utils/upgrade.sh diff --git a/utils/check_celery.sh b/utils/check_celery.sh index 4673e0918..ba2a8777a 100644 --- a/utils/check_celery.sh +++ b/utils/check_celery.sh @@ -1,7 +1,8 @@ #!/bin/bash -if [[ "$(ps axu | grep 'celery' | grep -v 'grep' | grep -cv 'defunct')" -gt "2" ]];then - exit 0 -else - exit 1 -fi \ No newline at end of file +set -e + +test -e /tmp/worker_ready_ansible +test -e /tmp/worker_ready_celery +test -e /tmp/worker_heartbeat_ansible && test $(($(date +%s) - $(stat -c %Y /tmp/worker_heartbeat_ansible))) -lt 10 +test -e /tmp/worker_heartbeat_celery && test $(($(date +%s) - $(stat -c %Y /tmp/worker_heartbeat_celery))) -lt 10 diff --git a/utils/upgrade.sh b/utils/upgrade.sh deleted file mode 100644 index f700c9f7d..000000000 --- a/utils/upgrade.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -if grep -q 'source /opt/autoenv/activate.sh' ~/.bashrc; then - echo -e "\033[31m 正在自动载入 python 环境 \033[0m" -else - echo -e "\033[31m 不支持自动升级,请参考 http://docs.jumpserver.org/zh/docs/upgrade.html 手动升级 \033[0m" - exit 0 -fi - -source ~/.bashrc - -cd `dirname $0`/ && cd .. && ./jms stop - -jumpserver_backup=/tmp/jumpserver_backup$(date -d "today" +"%Y%m%d_%H%M%S") -mkdir -p $jumpserver_backup -cp -r ./* $jumpserver_backup - -echo -e "\033[31m 是否需要备份Jumpserver数据库 \033[0m" -stty erase ^H -read -p "确认备份请按Y,否则按其他键跳过备份 " a -if [ "$a" == y -o "$a" == Y ];then - echo -e "\033[31m 正在备份数据库 \033[0m" - echo -e "\033[31m 请手动输入数据库信息 \033[0m" - read -p '请输入Jumpserver数据库ip:' DB_HOST - read -p '请输入Jumpserver数据库端口:' DB_PORT - read -p '请输入Jumpserver数据库名称:' DB_NAME - read -p '请输入有权限导出数据库的用户:' DB_USER - read -p '请输入该用户的密码:' DB_PASSWORD - mysqldump -h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PASSWORD $DB_NAME > /$jumpserver_backup/$DB_NAME$(date -d "today" +"%Y%m%d_%H%M%S").sql || { - echo -e "\033[31m 备份数据库失败,请检查输入是否有误 \033[0m" - exit 1 - } - echo -e "\033[31m 备份数据库完成 \033[0m" -else - echo -e "\033[31m 已取消备份数据库操作 \033[0m" -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" -stty erase ^? - -exit 0