The system and service manager loads a unit's configuration
automatically when a unit is referenced for the first time. It
will automatically unload the unit configuration and state again
when the unit is not needed anymore ("garbage collection"). A
unit may be referenced through a number of different mechanisms:
1. Another loaded unit references it with a dependency such as
After=, Wants=, ...
2. The unit is currently starting, running, reloading or
stopping.
3. The unit is currently in the failed
state. (But see below.)
4. A job for the unit is pending.
5. The unit is pinned by an active IPC client program.
6. The unit is a special "perpetual" unit that is always active
and loaded. Examples for perpetual units are the root mount
unit -.mount or the scope unit init.scope that the service
manager itself lives in.
7. The unit has running processes associated with it.
The garbage collection logic may be altered with the CollectMode=
option, which allows configuration whether automatic unloading of
units that are in failed
state is permissible, see below.
Note that when a unit's configuration and state is unloaded, all
execution results, such as exit codes, exit signals, resource
consumption and other statistics are lost, except for what is
stored in the log subsystem.
Use systemctl daemon-reload
or an equivalent command to reload
unit configuration while the unit is already loaded. In this case
all configuration settings are flushed out and replaced with the
new configuration (which however might not be in effect
immediately), however all runtime state is saved/restored.