[systemd-devel] Cannot get Shutdown Script to Run (Libvirt Virtual Machine Shutdown)

"Jóhann B. Guðmundsson" johannbg at gmail.com
Fri Oct 10 04:55:52 PDT 2014


On 10/10/2014 09:20 AM, Lennart Poettering wrote:
>   rule that if two
> units are ordered against each other, and one is started and one is
> stopped the stop will always be executed first, the start second,
> regardless if the actual ordering is After= or Before=

Yeah sure but there is a different between units that have been run ( 
thus started and or stopped either at boot up, by specific custom target 
and or manually ) and those that have never been run
( which for example is the case with all the units that are tied to the 
shutdown.target )


If I add shutdown-test.service to the After= line of the httpd.service 
it still does not get executed in the right order at shutdown

And

If I add Before=httpd.service to the shutdown-test.unit it still is not 
execuded in the right order at shutdown.

 From my perception the logic and thus the brokeness in the design seems 
to be due the fact that the ordering ( After=, Before= ) of units which 
have never been run are not being taken into account when atleast the 
shutdown.target is being run. ( Have not tested this with custom targets 
to see if those are affected as well )


> . Now, this
> means unless you want to run your code only after some other service
> shut down, everything is good. But if you want your code to run before
> some other unit is shut down, then you cannot express this with a
> service that is started at shutdown.
...
>
> Thus the recommended way to implement services that are execute right
> at the appropriate place in the shutdown order is to make it a service
> that is a NOP at start, and only contains ExecStop=.

To me this is a workaround which should not be needed or necessary and 
is due to what I consider the brokeness of the design ( or the 
implementation of that design ).
>
> It's not particularly pretty, but not that bad either. And better than
> the other options we saw...

You do realize that at this point in time and given how far we have 
come, you and those "we" which I assume consist of individuals of 
yourself dubbed "systemd cabal" which you deliberately with those words 
elevated those individual above everyone else in the community by 
creating the notion of an "A" team ( as opposed to simply name those 
individuals without setting an label on them ), will need to start doing 
better job of communicating thus for example sharing design discussions 
that that team has etc. with the community ( which consist of ever 
growing members from wide variety of distribution and embedded space ) 
so everyone can participate in those discussion as well as being aware 
and thus informed of what has been discussed and why those things have 
to be ( designed ) that way as well as considered the ideas of that self 
dubbed "systemd cabal " is not absolute and other ideas from the 
community might lead to a better implementation or design or different 
approach even something that "cabal" did not think of.

Just bear the above in mind.

JBG


More information about the systemd-devel mailing list