m_RetentionTimer = boost::make_shared<Timer>();
m_RetentionTimer->SetInterval(60);
- m_RetentionTimer->OnTimerExpired.connect(boost::bind(&IcingaApplication::RetentionTimerHandler, this));
+ m_RetentionTimer->OnTimerExpired.connect(boost::bind(&IcingaApplication::DumpProgramState, this));
m_RetentionTimer->Start();
/* register handler for 'log' config objects */
RunEventLoop();
+ DumpProgramState();
+
Logger::Write(LogInformation, "icinga", "Icinga shutting down.");
return EXIT_SUCCESS;
}
-void IcingaApplication::RetentionTimerHandler(void) {
- ConfigObject::DumpObjects("retention.dat");
+void IcingaApplication::DumpProgramState(void) {
+ ConfigObject::DumpObjects("retention.dat.tmp");
+ rename("retention.dat.tmp", "retention.dat");
}
void IcingaApplication::NewComponentHandler(const ConfigObject::Ptr& object)
Timer::Ptr m_RetentionTimer;
- void RetentionTimerHandler(void);
+ void DumpProgramState(void);
void NewComponentHandler(const ConfigObject::Ptr& object);
void DeletedComponentHandler(const ConfigObject::Ptr& object);