列出 (Shep)herd 的所有可用服务

列出 (Shep)herd 的所有可用服务

在 Guix 系统上,PID 1 称为 Shepherd,并使用命令进行控制herd。我经常发现自己想要用制表符补全以 开头的命令herd,例如:

$ sudo herd restart some<tab>

但如果缺少这一点,我什至无法找到一种方法来列出牧羊人已知的所有服务。帮助打印输出如下:

└$ sudo herd --help
herd [OPTIONS...] ACTION SERVICE [ARG...]
Apply ACTION (start, stop, status, etc.) on \
SERVICE with the ARGs.
  -s, --socket=FILE           send commands to FILE
      --help                  display this help and exit
      --usage                 display short usage message and exit
      --version               display version information and exit

并且似乎只提到应对服务采取的行动。信息和手册页都很简洁,仅列出了可用的操作。

     herd [OPTION...] ACTION [SERVICE [ARG...]]

   It causes the ACTION of the SERVICE to be invoked.  When SERVICE is
omitted and ACTION is ‘status’ or ‘detailed-status’, the ‘root’ service
is used(1) (*note The root and unknown services::, for more information
on the ‘root’ service.)

   For each action, you should pass the appropriate ARGs.  Actions that
are available for every service are ‘start’, ‘stop’, ‘restart’,
‘status’, ‘enable’, ‘disable’, and ‘doc’.

答案1

事实证明该操作有未记录的用法status。至少没有记录在案,从未被明确提及。如果没有参数,herd status将列出它已知的所有服务,例如:

$ sudo herd status
Started:
 + avahi-daemon
 + console-font-tty1
 + console-font-tty2
...

相关内容