Команда Systemctl для отображения сводки текущих служб

Какой вариант или команда systemctl я использовал бы для отображения сводки всех запущенных в данный момент сервисов?

11
задан 14 November 2017 в 21:00

4 ответа

Это (см. man 1 systemctl):

systemctl list-units | grep -E 'service.*running'

или (см. также man 1 systemctl )

service --status-all

Где [+] указывает службы, которые фактически запущены.

11
ответ дан 18 July 2018 в 03:17

Вы можете использовать некоторые из опций systemctl:

-t, --type= The argument should be a comma-separated list of unit types such as service and socket. If one of the arguments is a unit type, when listing units, limit display to certain unit types. Otherwise, units of all types will be shown. As a special case, if one of the arguments is help, a list of allowed values will be printed and the program will exit. --state= The argument should be a comma-separated list of unit LOAD, SUB, or ACTIVE states. When listing units, show only those in the specified states. Use --state=failed to show only failed units. As a special case, if one of the arguments is help, a list of allowed values will be printed and the program will exit.

Возможно, вы хотите:

systemctl --type=service --state=active list-units

В списке перечислены все активные службы, в том числе те, которые вышли , Если вы только после тех, кто работает в данный момент, вы можете использовать:

systemctl --type=service --state=running list-units
19
ответ дан 18 July 2018 в 03:17

Это (см. man 1 systemctl):

systemctl list-units | grep -E 'service.*running'

или (см. также man 1 systemctl )

service --status-all

Где [+] указывает службы, которые фактически запущены.

11
ответ дан 24 July 2018 в 17:48

Вы можете использовать некоторые из опций systemctl:

-t, --type= The argument should be a comma-separated list of unit types such as service and socket. If one of the arguments is a unit type, when listing units, limit display to certain unit types. Otherwise, units of all types will be shown. As a special case, if one of the arguments is help, a list of allowed values will be printed and the program will exit. --state= The argument should be a comma-separated list of unit LOAD, SUB, or ACTIVE states. When listing units, show only those in the specified states. Use --state=failed to show only failed units. As a special case, if one of the arguments is help, a list of allowed values will be printed and the program will exit.

Возможно, вы хотите:

systemctl --type=service --state=active list-units

В списке перечислены все активные службы, в том числе те, которые вышли , Если вы только после тех, кто работает в данный момент, вы можете использовать:

systemctl --type=service --state=running list-units
19
ответ дан 24 July 2018 в 17:48
  • 1
    Команда systemctl без каких-либо подкоманд предполагает list-units, поэтому ... systemctl --type-service --state=running или просто обычная systemctl для быстрого использования. – muru 15 November 2017 в 05:43

Другие вопросы по тегам:

Похожие вопросы: