MEDIUM: mworker: exit-on-failure option
This option exits every workers when one of the current workers die.
It allows you to monitor the master process in order to relaunch
everything on a failure.
For example it can be used with systemd and Restart=on-failure in a spec
file.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index bdf55a8..76a4f31 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -625,8 +625,17 @@
global.mode |= MODE_DAEMON;
}
else if (!strcmp(args[0], "master-worker")) {
- if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
goto out;
+ if (*args[1]) {
+ if (!strcmp(args[1], "exit-on-failure")) {
+ global.tune.options |= GTUNE_EXIT_ONFAILURE;
+ } else {
+ Alert("parsing [%s:%d] : '%s' only supports 'exit-on-failure' option.\n", file, linenum, args[0]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+ }
global.mode |= MODE_MWORKER;
}
else if (!strcmp(args[0], "debug")) {