X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a65f0d5b294d9a5d90e4767ef50857c4cf3589b2..53fc6852863d3a7c646d0d81c98848518a634428:/projects/stargazer/main.cpp diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index 3db3b266..b878b39c 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -66,7 +66,7 @@ namespace std::set executers; void StartTimer(); -int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings); +int StartScriptExecuter(char * procName, int msgKey, int * msgID); int ForkAndWait(const std::string & confDir); void KillExecuters(); @@ -89,9 +89,9 @@ else } //----------------------------------------------------------------------------- #if defined(LINUX) || defined(DARWIN) -int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings) +int StartScriptExecuter(char * procName, int msgKey, int * msgID) #else -int StartScriptExecuter(char *, int msgKey, int * msgID, SETTINGS_IMPL * settings) +int StartScriptExecuter(char *, int msgKey, int * msgID) #endif { STG_LOGGER & WriteServLog = GetStgLogger(); @@ -132,7 +132,6 @@ switch (pid) return -1; case 0: - delete settings; #if defined(LINUX) || defined(DARWIN) Executer(*msgID, pid, procName); #else @@ -251,7 +250,7 @@ WriteServLog("Stg v. %s", SERVER_VERSION); for (size_t i = 0; i < settings.GetExecutersNum(); i++) { - int ret = StartScriptExecuter(argv[0], settings.GetExecMsgKey(), &msgID, &settings); + int ret = StartScriptExecuter(argv[0], settings.GetExecMsgKey(), &msgID); if (ret < 0) { STG_LOGGER & WriteServLog = GetStgLogger(); @@ -339,8 +338,22 @@ while (running) switch (sig) { case SIGHUP: + { + SETTINGS_IMPL newSettings(settings); + if (newSettings.ReadSettings()) + { + STG_LOGGER & WriteServLog = GetStgLogger(); + + if (newSettings.GetLogFileName() != "") + WriteServLog.SetLogFileName(newSettings.GetLogFileName()); + + WriteServLog("ReadSettings error. %s", newSettings.GetStrError().c_str()); + return -1; + } + settings = newSettings; traffCnt.Reload(); - manager.reload(); + manager.reload(settings); + } break; case SIGTERM: running = false;