[systemd-devel] systemctl status etc attempts to load unit

Lennart Poettering lennart at poettering.net
Wed Apr 27 08:28:20 UTC 2016


On Tue, 26.04.16 21:31, Andrei Borzenkov (arvidjaar at gmail.com) wrote:

> I was grown to believe that I need "systemctl daemon-reload" to make
> systemd recognize new units, but apparently it is no more the case. Just
> dropping unit definition in standard place and running "systemctl status
> new-unit" is enough to trigger systemd into loading it.
> 
> It apparently is not affected by --no-reload flag and is true for any
> systemctl command that takes unit name as argument.
> 
> Does my memory fail me and it has always been the case? I tentatively
> tracked this to commit 718db96199eb307751264e4163555662c9a389fa.

it has been that way pretty much always. much before that
commit. Basically, we only keep referenced, running and failed units
in memory, and release everything else as soon as it has no references
anymore. The backside of the medal hence requires us to implicitly
load again what starts to be referenced again.

> Note that behavior is also inconsistent when taking patterns in account.
> It means that
> 
> systemctl status foo
> 
> behaves differently from
> 
> systemctl status foo*

Yes it does. The pattern stuff is reliable only for services you know
are referenced/started..

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list