25.08.2019 19:57, Hans-Dieter Doll пишет: > On shutdown we need to stop a service before systemd begins to kill all processes it does not know. > The service is a process supervisor similar to init, which controls all our applications. > Our applications must be terminated by this supervisor, otherwise data loss and inconsistencies will occur. > > The problem is: aside from background processes started by the supervisor, we have applications started in a user > session, but which are also controlled by the supervisor. > This is something systemd cannot know, and thus it kills these applications in parallel to shutting down our service. > So we require systemd to wait for our service to terminate before it begins to kill other processes. > > From an arch-linux thread in 2017 I concluded this is not possible due to the design of systemd. > > But I cannot believe we are the only one requiring this. > So my question is: is there nowadays some mechanism available to accomplish this? > If your application runs as part of user systemd instance and assuming recent enough systemd you should be able to order user@.service Before your supervisor service (via drop-in) so that supervisor will be stopped before any user sytsemd instance. If your application runs as user session process, I do not think it is possible. Session scope unit does not have any Before dependency nor is it templateable.
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel