[systemd-devel] systemctl start second.service first.service

Michael Chapman mike at very.puzzling.org
Fri Jan 12 08:55:32 UTC 2018


On Fri, 12 Jan 2018, Andrei Borzenkov wrote:
> 12.01.2018 03:47, 林自均 пишет:
>> How about adding an "--order" option to systemctl? With this option,
>> systemctl will sort those units by ordering dependencies before submitting
>> them.
>
> And why does it matter? If unit A can be started without unit B, why
> does it matter in which order they are started? If unit A can *not* be
> started without unit B, it must tell so using Requires or Requisite.

I actually do think there is merit having this _always_ done with a single 
transaction.

Just because you want ordering doesn't necessarily you care about 
requirements. You may have a set of Type=oneshot units, for instance, and 
you don't particularly care whether any of them fail, but they must be run 
in a particular order. Currently, you need to make sure that order is 
reflected in the systemctl arguments. It would be nice for the order to be 
derived correctly from their ordering dependencies.

With all jobs in a single transaction, you could use systemctl's 
--job-mode=fail option to determine whether the _entire_ transaction is 
safe to be applied. This would honor Conflicts= in units without requiring 
the user to list units in the correct order.

Thinking somewhat further ahead, I can imagine their might even be a 
use-case for having transactions represented in the DBus API. That way a 
client could build a transaction (start this unit, stop that unit, etc.), 
and apply it all at once.


More information about the systemd-devel mailing list