From 2820dc579dad400c8b0f4dfe4220c3d78e218645 Mon Sep 17 00:00:00 2001 From: gongzt Date: Wed, 30 Aug 2023 15:41:06 +0800 Subject: [PATCH] = Optimize start service check logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aops-vulcanus | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aops-vulcanus b/aops-vulcanus index abb02b1..ba854f9 100644 --- a/aops-vulcanus +++ b/aops-vulcanus @@ -100,8 +100,13 @@ function is_started() { function start_service() { module_name=$1 echo "[INFO] 1. Before starting the service, ensure that the data table is initialized" - echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zues'" + echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'" uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads + pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'` + if [ "${pid}" = "" ]; then + echo "[ERROR] start uwsgi service: ${module_name} failed" + exit 1 + fi echo "[INFO] start uwsgi service: ${module_name} success" exit 0 } @@ -167,7 +172,7 @@ function check_mysql_installed() { aops_database=$(get_config "$CONFIG_FILE" "mysql" "database_name") connect_check_cmd="import pymysql try: - connect = pymysql.connect(host='$mysql_ip', port=$port, password='123456', database='$aops_database') + connect = pymysql.connect(host='$mysql_ip', port=$port, database='$aops_database') connect.close() except pymysql.err.OperationalError: print(False) -- Gitee