From 822745e06690655204689cd9337a00699e181a89 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 25 Nov 2024 20:00:35 +0800 Subject: [PATCH] 11-25 --- jsonparse/mqtt_cmd_parse.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jsonparse/mqtt_cmd_parse.cpp b/jsonparse/mqtt_cmd_parse.cpp index 74fa1eb..a5d2ce6 100644 --- a/jsonparse/mqtt_cmd_parse.cpp +++ b/jsonparse/mqtt_cmd_parse.cpp @@ -714,7 +714,18 @@ void JsonData::DataNodeStatusCheck() { } if (count == nSize && nodeOnline && count != 0) { zlog_error(zct, "ALL Node offline,count = %d", count); - exit(0); + char whereCon[64]={0}; + sprintf(whereCon,"DATE(timestamp, 'unixepoch') = DATE('now') ORDER BY timeStamp DESC limit 0,1"); + std::string strCount = sqlite_db_ctrl::instance().GetData(" reboot_record ", "count", whereCon); + if (atoi(strCount.c_str()) < 3)//当天大于三次不再重启进程 + { + char insertSql[64] = {0}; + sprintf(insertSql, "'%s',%d,'%s'",localtimestamp,atoi(strCount.c_str())+1,"ALL Node offline"); + sqlite_db_ctrl::instance().InsertData(" reboot_record ", insertSql); + exit(0); + }else{ + zlog_warn(zct, "reboot now count = %d",atoi(strCount.c_str())); + } } } }