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

Reindl Harald h.reindl at thelounge.net
Fri Jan 12 09:48:48 UTC 2018



Am 12.01.2018 um 09:55 schrieb Michael Chapman:
> On Fri, 12 Jan 2018, Andrei Borzenkov wrote:
>> 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

it's simple: Require is just plain wrong in many cases, oneshot or not

* dbmail needs a database
* that can either be postgresql or mysql
* so any unit which Require one of them would be wrong
* systemctl restart mysqld dbmail-imapd
   problem: database goes down while imap still accepts clients
* systemctl restart dbmail-imapd mysqld
   problem: straight after start you take down the database

at boot it would be start mysqld -> start dbmail-imapd
at shutdown it would be stop dbmail-imapd -> stop mysqld

just because "dbmail-imapd" has "After=postgresql mysqld"
only "systemctl restart" can never do the correct thing

you can't Require mysql because it's wrong when postgresql is used
you can't Require postgresql because it's wrong when mysql is used

frankly it makes me tired - i have not enough colored pencils to explain 
it so that people which decide to even not try to understand something 
gasp it


More information about the systemd-devel mailing list