[systemd-devel] Adopt processes spawned before /lib/systemd/systemd takes over as PID 1?

Lennart Poettering lennart at poettering.net
Wed May 6 09:22:32 PDT 2015


On Wed, 06.05.15 09:28, Matt Hoosier (matt.hoosier at gmail.com) wrote:

> One final question on this topic:
> 
> I'm not sure from the available discussion of the 'Alias=' directive in
> systemd.unit(5) whether it might be possible for me to have two units:
> 
>   /lib/systemd/system/dummy-adopted-service.service
>     ...
>     [Unit]
>     DefaultDependencies=no
> 
>     [Service]
>     Type=forking
>     PIDFile=/var/run/already-forked-process.pid
>     ExecStart=/bin/true
> 
>     [Install]
>     Alias=the-service.service
>     Wanted-By=sysinit.target
> 
>   /lib/systemd/system/real-service.service
>     ...
>     [Install]
>     Alias=the-service.service
> 
> such that clients always phrase their dependencies in terms of the aliased
> name ("the-service.service"). At startup time, the virtual unit name would
> always happen to be satisfied by dummy-adopted-service.service, but any
> subsequent restarts would be accomplished by systemd noticing that
> real-service.service exists and using it in preference over
> dummy-adopted-service.service.
> 
> My gut feeling is that this approach doesn't play well with the way that
> 'systemctl enable' wants to place alias symlinks into /etc/systemd/system/.
> I.e., I think that systemd will only ever recognize one provider of the
> virtual/aliased service name.

Yes, each name may only refert to one single unit at a time.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list