aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2013-07-25 14:07:59 +0200
committerLennart Poettering <lennart@poettering.net>2013-09-12 18:29:44 +0200
commitdc99a9764418a1974c46c55efa73b034f530a5a5 (patch)
treeb74c9e03549e3cfdde0ed41752b79033e1824344
parentjournald: Log error when failed to get machine-id on start (diff)
downloadsystemd-dc99a9764418a1974c46c55efa73b034f530a5a5.tar.gz
systemd-dc99a9764418a1974c46c55efa73b034f530a5a5.tar.bz2
systemd-dc99a9764418a1974c46c55efa73b034f530a5a5.zip
service: Implement 'on-watchdog' restart option
Services using the watchdog option might want to be restarted only if the watchdog triggers.
-rw-r--r--man/systemd.service.xml5
-rw-r--r--src/core/service.c2
-rw-r--r--src/core/service.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index a15dfb2cb..1eb5f3962 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -618,6 +618,7 @@
<option>no</option>,
<option>on-success</option>,
<option>on-failure</option>,
+ <option>on-watchdog</option>,
<option>on-abort</option>, or
<option>always</option>. If set to
<option>no</option> (the default) the
@@ -644,6 +645,10 @@
signal not specified as a clean exit
status.
If set to
+ <option>on-watchdog</option> the service
+ will be restarted only if the watchdog
+ timeout for the service expires.
+ If set to
<option>always</option> the service
will be restarted regardless whether
it exited cleanly or not, got
diff --git a/src/core/service.c b/src/core/service.c
index 34dde7963..08b929e4f 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1937,6 +1937,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
(s->restart == SERVICE_RESTART_ALWAYS ||
(s->restart == SERVICE_RESTART_ON_SUCCESS && s->result == SERVICE_SUCCESS) ||
(s->restart == SERVICE_RESTART_ON_FAILURE && s->result != SERVICE_SUCCESS) ||
+ (s->restart == SERVICE_RESTART_ON_WATCHDOG && s->result == SERVICE_FAILURE_WATCHDOG) ||
(s->restart == SERVICE_RESTART_ON_ABORT && (s->result == SERVICE_FAILURE_SIGNAL ||
s->result == SERVICE_FAILURE_CORE_DUMP))) &&
(s->result != SERVICE_FAILURE_EXIT_CODE ||
@@ -3791,6 +3792,7 @@ static const char* const service_restart_table[_SERVICE_RESTART_MAX] = {
[SERVICE_RESTART_NO] = "no",
[SERVICE_RESTART_ON_SUCCESS] = "on-success",
[SERVICE_RESTART_ON_FAILURE] = "on-failure",
+ [SERVICE_RESTART_ON_WATCHDOG] = "on-watchdog",
[SERVICE_RESTART_ON_ABORT] = "on-abort",
[SERVICE_RESTART_ALWAYS] = "always"
};
diff --git a/src/core/service.h b/src/core/service.h
index 182cba133..ce5b5e04a 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -54,6 +54,7 @@ typedef enum ServiceRestart {
SERVICE_RESTART_NO,
SERVICE_RESTART_ON_SUCCESS,
SERVICE_RESTART_ON_FAILURE,
+ SERVICE_RESTART_ON_WATCHDOG,
SERVICE_RESTART_ON_ABORT,
SERVICE_RESTART_ALWAYS,
_SERVICE_RESTART_MAX,