Implemented external command "SHUTDOWN_PROGRAM".

This commit is contained in:
Gunnar Beutner 2013-01-22 16:23:25 +01:00
parent 856c5c5a8a
commit a63a1002a8
2 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,7 @@ void ExternalCommand::Execute(double time, const String& command, const vector<S
RegisterCommand("SCHEDULE_FORCED_SVC_CHECK", &ExternalCommand::ScheduleForcedSvcCheck); RegisterCommand("SCHEDULE_FORCED_SVC_CHECK", &ExternalCommand::ScheduleForcedSvcCheck);
RegisterCommand("ENABLE_SVC_CHECK", &ExternalCommand::EnableSvcCheck); RegisterCommand("ENABLE_SVC_CHECK", &ExternalCommand::EnableSvcCheck);
RegisterCommand("DISABLE_SVC_CHECK", &ExternalCommand::DisableSvcCheck); RegisterCommand("DISABLE_SVC_CHECK", &ExternalCommand::DisableSvcCheck);
RegisterCommand("SHUTDOWN_PROCESS", &ExternalCommand::ShutdownProcess);
m_Initialized = true; m_Initialized = true;
} }
@ -145,3 +146,9 @@ void ExternalCommand::DisableSvcCheck(double time, const vector<String>& argumen
service->SetEnableChecks(false); service->SetEnableChecks(false);
} }
void ExternalCommand::ShutdownProcess(double time, const vector<String>& arguments)
{
Logger::Write(LogInformation, "icinga", "Shutting down Icinga via external command.");
Application::RequestShutdown();
}

View File

@ -34,6 +34,7 @@ public:
static void ScheduleForcedSvcCheck(double time, const vector<String>& arguments); static void ScheduleForcedSvcCheck(double time, const vector<String>& arguments);
static void EnableSvcCheck(double time, const vector<String>& arguments); static void EnableSvcCheck(double time, const vector<String>& arguments);
static void DisableSvcCheck(double time, const vector<String>& arguments); static void DisableSvcCheck(double time, const vector<String>& arguments);
static void ShutdownProcess(double time, const vector<String>& arguments);
private: private:
typedef function<void (double time, const vector<String>& arguments)> Callback; typedef function<void (double time, const vector<String>& arguments)> Callback;