如何列出在systemd中的某些服务之后启动的所有服务

S.R*_*.R. 6 systemd

我想以这种方式(如果可能)找到哪些服务在启动之前等待NetworkManager-wait-online.service执行?

Byt*_*der 8

我认为您正在寻找的命令是:

$ systemctl list-dependencies --reverse NetworkManager-wait-online.service 
NetworkManager-wait-online.service
? ??network-online.target
?   ??hddtemp.service
Run Code Online (Sandbox Code Playgroud)

来自man systemctl

   list-dependencies [NAME]
       Shows units required and wanted by the specified unit. This
       recursively lists units following the Requires=, Requisite=,
       ConsistsOf=, Wants=, BindsTo= dependencies. If no unit is
       specified, default.target is implied.

       By default, only target units are recursively expanded. When --all
       is passed, all other units are recursively expanded as well.

       Options --reverse, --after, --before may be used to change what
       types of dependencies are shown.

   --reverse
       Show reverse dependencies between units with list-dependencies,
       i.e. follow dependencies of type WantedBy=, RequiredBy=, PartOf=,
       BoundBy=, instead of Wants= and similar.
Run Code Online (Sandbox Code Playgroud)