[systemd-devel] Creating new targets to order shutdown

Ray Nichols ray.nichols at piksel.com
Tue Jan 17 17:45:43 UTC 2017


17.01.2017 18:21, Ray Nichols пишет:
> Hello,
> 
> 
> 
> I'm interested in a particular scenario which has been mentioned on
> mailing lists before:
> 
> https://www.mail-archive.com/search?l=systemd-devel@lists.freedesktop.org&q=subject:%22%5C%5Bsystemd%5C-devel%5C%5D+after%3Duser.slice+not+enforced%22&o=newest&f=1
>
> 
> 
> 
> 
> 
> about stopping a database service. For the moment I'm considering the
> simplest case where systemd controls both the start and stopping of
> the service (though I'm mainly interested in the stop).
> 
> 
> 
> 
> 
> What I'm finding in testing is that I cannot find an approach that
> stops the service before its user processes get killed first.
> 
> 


User processes belong to scope units. Scope units are created
programmatically by logind and have predefined set of dependencies.
There is no hooks to change it from logind side; and because names are
not predictable (and do not use templates) it is not possible to use
drop ins. So there is really no way to order anything against user
sessions unless you patch logind source.


Thanks for that. Yes, the kind of service that I'm wanting to manage can have literally hundreds of user sessions created for it. The stop script I have can cleanly handle this easily *but* must not run in parallel with any other shutting down of service units or removal of user sessions. Is it the case that this use-case on Linux must be handled outside of systemd? (I'm not even sure what alternative that might be as yet.) My own experience is with Oracle databases but other databases like PostgreSQL and MySQL will surely have similar requirements here. I'm obviously keen for all server shutdown initiation approaches to work and not have a shell script wrapper around the shutdown call to do some work first.



More information about the systemd-devel mailing list