From 29fc212e9c1c7dd546f9ff7979f3ff6f98b7263d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 19 Sep 2024 23:01:43 +0000 Subject: [PATCH] Honor --initial after a crash , see #4659 Closes #4659 --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f0ccb8f4b..3615fbb74 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1671,6 +1671,13 @@ bool ProxySQL_daemonize_phase3() { // automatic reload of TLS certificates after a crash , see #4658 std::string msg; ProxySQL_create_or_load_TLS(false, msg); + // Honor --initial after a crash , see #4659 + if (GloVars.__cmd_proxysql_initial==true) { + std::cerr << "Renaming database file " << GloVars.admindb << endl; + char *newpath=(char *)malloc(strlen(GloVars.admindb)+8); + sprintf(newpath,"%s.bak",GloVars.admindb); + rename(GloVars.admindb,newpath); // FIXME: should we check return value, or ignore whatever it successed or not? + } parent_close_error_log(); return false; }