mirror of
https://github.com/troglobit/finit.git
synced 2026-10-21 11:29:42 +00:00
Follow-up to 10b72f1: periodically age service crash counter
Traditionally we've reset the service restart counter on two occasions: 1) when a service reaches its max crash count (default 10), and 2) when a service somehow "stabilizes" In the second case the service is restored to normal running state and we "forget" its bad previous behavior. Meaning we cannot catch daemons that act in an unstable manner outside the "rage quit" scenario. This patch allows for slowing aging (decrementing) the restart counter once every five minutes. Meaning we still catch rage quitters but now are also able catch other types of misbehavior. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ee867e7f3b
commit
449bc7d12b
5 files changed
+94
-1
No files matched your search
+21
@@ -41,6 +41,7 @@
|
||||
#include "finit.h"
|
||||
#include "cond.h"
|
||||
#include "iwatch.h"
|
||||
#include "private.h"
|
||||
#include "service.h"
|
||||
#include "tty.h"
|
||||
#include "helpers.h"
|
||||
@@ -572,6 +573,26 @@ static void parse_static(char *line, int is_rcsd)
|
||||
cfglevel = 2; /* Fallback */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Periodic check and instability index leveler, seconds
|
||||
*/
|
||||
if (MATCH_CMD(line, "service-interval ", x)) {
|
||||
char *token = strip_line(x);
|
||||
const char *err = NULL;
|
||||
int val;
|
||||
|
||||
/* 0 min to 1 day, should check at least daily */
|
||||
val = strtonum(token, 0, 1440, &err);
|
||||
if (!err) {
|
||||
int disabled = !service_interval;
|
||||
|
||||
service_interval = val * 1000; /* to milliseconds */
|
||||
if (disabled)
|
||||
service_init();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void parse_dynamic(char *line, struct rlimit rlimit[], char *file)
|
||||
|
||||
Reference in new issue
Block a user