summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-service.c23
-rw-r--r--src/shared/bus-unit-util.c2
2 files changed, 24 insertions, 1 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 61b83d2d62..85b67318ed 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -143,6 +143,29 @@ static int bus_service_set_transient_property(
return 1;
+ } else if (streq(name, "Restart")) {
+ ServiceRestart sr;
+ const char *v;
+
+ r = sd_bus_message_read(message, "s", &v);
+ if (r < 0)
+ return r;
+
+ if (isempty(v))
+ sr = SERVICE_RESTART_NO;
+ else {
+ sr = service_restart_from_string(v);
+ if (sr < 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid restart setting: %s", v);
+ }
+
+ if (mode != UNIT_CHECK) {
+ s->restart = sr;
+ unit_write_drop_in_private_format(UNIT(s), mode, name, "Restart=%s", service_restart_to_string(sr));
+ }
+
+ return 1;
+
} else if (STR_IN_SET(name,
"StandardInputFileDescriptor",
"StandardOutputFileDescriptor",
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 735b8effc9..b030b3b9d1 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -266,7 +266,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
"StandardInput", "StandardOutput", "StandardError",
"Description", "Slice", "Type", "WorkingDirectory",
"RootDirectory", "SyslogIdentifier", "ProtectSystem",
- "ProtectHome", "SELinuxContext"))
+ "ProtectHome", "SELinuxContext", "Restart"))
r = sd_bus_message_append(m, "v", "s", eq);
else if (streq(field, "SyslogLevel")) {