MCPcopy Create free account
hub / github.com/Icinga/icinga2 / StartReloadProcess

Method StartReloadProcess

lib/base/application.cpp:400–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400pid_t Application::StartReloadProcess()
401{
402 // prepare arguments
403 ArrayData args;
404 args.push_back(GetExePath(m_ArgV[0]));
405
406 for (int i=1; i < Application::GetArgC(); i++) {
407 if (std::string(Application::GetArgV()[i]) != "--reload-internal")
408 args.push_back(Application::GetArgV()[i]);
409 else
410 i++; // the next parameter after --reload-internal is the pid, remove that too
411 }
412
413#ifndef _WIN32
414 args.push_back("--reload-internal");
415 args.push_back(Convert::ToString(Utility::GetPid()));
416#else /* _WIN32 */
417 args.push_back("--validate");
418#endif /* _WIN32 */
419
420 double reloadTimeout = Application::GetReloadTimeout();
421
422 Process::Ptr process = new Process(Process::PrepareCommand(new Array(std::move(args))));
423 process->SetTimeout(reloadTimeout);
424 process->Run(&ReloadProcessCallback);
425
426 Log(LogInformation, "Application")
427 << "Got reload command: Started new instance with PID '"
428 << (unsigned long)(process->GetPID()) << "' (timeout is "
429 << reloadTimeout << "s).";
430
431 return process->GetPID();
432}
433
434/**
435 * Signals the application to shut down during the next

Callers

nothing calls this directly

Calls 5

LogClass · 0.85
push_backMethod · 0.80
SetTimeoutMethod · 0.80
GetPIDMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected