diff --git a/man/systemctl.xml b/man/systemctl.xml index 755a74f987..1fb056874c 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -888,6 +888,11 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service Example: systemctl set-property foobar.service CPUShares=777 + If the specified unit appears to be inactive, the + changes will be only stored on disk as described + previously hence they will be effective when the unit will + be started. + Note that this command allows changing multiple properties at the same time, which is preferable over setting them individually. Like unit file configuration diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index d3bcc795ae..f58ac55009 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -630,9 +630,13 @@ static int method_set_unit_properties(sd_bus_message *message, void *userdata, s if (r < 0) return r; - u = manager_get_unit(m, name); - if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s is not loaded.", name); + r = manager_load_unit(m, name, NULL, error, &u); + if (r < 0) + return r; + + r = bus_unit_check_load_state(u, error); + if (r < 0) + return r; return bus_unit_method_set_properties(message, u, error); }