2009-04-02 Ramon Novoa <rnovoa@artica.es>

* modules/pandora_module_proc.cc,
          modules/pandora_module_proc.h: Fixed module_startdelay and
          module_retrydelay behavior.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1592 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2009-04-02 17:38:14 +00:00
parent f169f13d81
commit 4f89b62d41
3 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2009-04-02 Ramon Novoa <rnovoa@artica.es>
* modules/pandora_module_proc.cc,
modules/pandora_module_proc.h: Fixed module_startdelay and
module_retrydelay behavior.
2009-03-24 Esteban Sanchez <estebans@artica.es>
* udp_server/udp_server.cc, udp_server/udp_server.h: Replaced

View File

@ -49,9 +49,9 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name)
this->watchdog = false;
this->start_command = "";
this->retries = INT_MAX;
this->start_delay = MIN_DELAY;
this->retry_delay = MIN_DELAY;
this->retries = 3;
this->start_delay = 5000;
this->retry_delay = 2000;
}
string
@ -104,7 +104,7 @@ Pandora_Module_Proc::setRetries (int retries) {
void
Pandora_Module_Proc::setStartDelay (int mseconds) {
if (mseconds < MIN_DELAY) {
if (mseconds < 0) {
return;
}
@ -113,7 +113,7 @@ Pandora_Module_Proc::setStartDelay (int mseconds) {
void
Pandora_Module_Proc::setRetryDelay (int mseconds) {
if (mseconds < MIN_DELAY) {
if (mseconds < 0) {
return;
}
@ -136,7 +136,6 @@ async_run (Pandora_Module_Proc *module) {
Sleep (module->getStartDelay ());
while (1) {
Sleep (module->getStartDelay ());
processes = getProcessHandles (module->getProcessName ());
if (processes == NULL) {
if (module->isWatchdog ()) {
@ -145,15 +144,14 @@ async_run (Pandora_Module_Proc *module) {
continue;
}
/* Retrying... */
if (counter > 0) {
Sleep (module->getRetryDelay ());
}
Sleep (module->getRetryDelay ());
Pandora_Wmi::runProgram (module->getStartCommand ());
Sleep (module->getStartDelay ());
counter++;
continue;
}
Sleep (module->getRetryDelay ());
Sleep (2000);
continue;
}

View File

@ -23,8 +23,6 @@
#include "pandora_module.h"
#define MIN_DELAY 2000 /* Minimum process start/retry delay */
namespace Pandora_Modules {
/**
* Module to check that a process is running on the system.