summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-01 17:50:43 +0100
committerLennart Poettering <lennart@poettering.net>2010-11-10 22:38:43 +0100
commit2edfa36685588a5e224d1f86b3fcc16c46766fea (patch)
tree78fd13375df2f07a740996b1f21ab7e49f9d4fb4 /src/service.c
parent52da68821bb66871cf574989084c55b4d13d02b4 (diff)
service: delay automatic restart if job is pending
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index d3c750e544..0b54e5bfcf 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2039,6 +2039,13 @@ static void service_enter_restart(Service *s) {
assert(s);
dbus_error_init(&error);
+ if (s->meta.job) {
+ log_info("Job pending for unit, delaying automatic restart.");
+
+ if ((r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch)) < 0)
+ goto fail;
+ }
+
service_enter_dead(s, true, false);
if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, &error, NULL)) < 0)