std::set<pid_t> 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();
}
//-----------------------------------------------------------------------------
#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();
return -1;
case 0:
- delete settings;
#if defined(LINUX) || defined(DARWIN)
Executer(*msgID, pid, procName);
#else
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();
PIDFile pidFile(settings.GetPIDFileName());
+struct sigaction sa;
+memset(&sa, 0, sizeof(sa));
+sa.sa_handler = SIG_DFL;
+sigaction(SIGHUP, &sa, NULL); // Apparently FreeBSD ignores SIGHUP by default when launched from rc.d at bot time.
+
sigset_t signalSet;
sigfillset(&signalSet);
pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
switch (sig)
{
case SIGHUP:
+ {
+ SETTINGS_IMPL newSettings(settings);
+ if (newSettings.ReadSettings())
+ WriteServLog("ReadSettings error. %s", newSettings.GetStrError().c_str());
+ else
+ settings = newSettings;
+ WriteServLog.SetLogFileName(settings.GetLogFileName());
traffCnt.Reload();
- manager.reload();
+ manager.reload(settings);
+ }
break;
case SIGTERM:
running = false;
WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
+manager.stop();
+
if (loop.Stop())
WriteServLog("Event loop not stopped.");