84 |
* Walk the process-list and validate each process |
* Walk the process-list and validate each process |
85 |
*/ |
*/ |
86 |
void validate() { |
void validate() { |
87 |
|
|
88 |
Process_T p; |
Process_T p; |
89 |
|
|
90 |
if ( ! update_loadavg() ) { |
if ( ! update_loadavg() ) { |
91 |
|
|
92 |
log("Update of loadavg has failed!\n"); |
log("Update of loadavg has failed!\n"); |
93 |
|
|
94 |
} |
} |
95 |
|
|
96 |
for (p= processlist; p; p= p->next) { |
for (p= processlist; p; p= p->next) { |
97 |
|
|
98 |
do_validate(p); |
do_validate(p); |
99 |
|
|
100 |
} |
} |
133 |
/* Test for running process */ |
/* Test for running process */ |
134 |
if (!(pid= is_process_running(p))) { |
if (!(pid= is_process_running(p))) { |
135 |
|
|
|
log("'%s' is not running.\n", p->name); |
|
136 |
do_start(p, "Reason: Process is not running."); |
do_start(p, "Reason: Process is not running."); |
137 |
goto reinstall; |
goto reinstall; |
138 |
|
|
252 |
|
|
253 |
log("Trying to restart '%s'\n", p->name); |
log("Trying to restart '%s'\n", p->name); |
254 |
|
|
255 |
control_process(p, "stop", FORCE_CONTROL); |
check_process(p->name, "stop", FALSE); |
256 |
sleep(10); /* Wait for process termination */ |
sleep(10); /* Wait for process termination */ |
257 |
|
|
258 |
} |
} |
288 |
if(p->mode!= MODE_PASSIVE) { |
if(p->mode!= MODE_PASSIVE) { |
289 |
|
|
290 |
/* Start process and take care of dependants */ |
/* Start process and take care of dependants */ |
291 |
control_process(p, "start", FORCE_CONTROL); |
check_process(p->name, "start", FALSE); |
292 |
|
|
293 |
/* In the case we just started our own smtp server we'll |
/* In the case we just started our own smtp server we'll |
294 |
* sleep before attempting to send alert */ |
* sleep before attempting to send alert */ |
338 |
sleep(3); |
sleep(3); |
339 |
|
|
340 |
/* Stop the process and dependants */ |
/* Stop the process and dependants */ |
341 |
control_process(p, "stop", FORCE_CONTROL); |
check_process(p->name, "stop", FALSE); |
342 |
|
|
343 |
} else { |
} else { |
344 |
|
|