O que é o parâmetro [PATTERN] para “systemctl list-units”

2

A página man do systemctl diz:

Unit Commands

list-units [PATTERN...] List known units (subject to limitations specified with -t). If one or more PATTERNs are specified, only units matching one of them are shown.

This is the default command.

Minha pergunta é o que significa [PATTERN] .

Quando executo systemctl list-units , recebo uma lista relativamente longa das unidades carregadas. Mas se eu adicionar um terceiro argumento, recebo uma mensagem de erro Too many arguments. Então, estou curioso para saber quais parâmetros são válidos para o argumento [PATTERN] listado na página man.

(Estou executando o Arch Linux e tenho a versão 227 do systemd)

    
por Gabriel Southern 12.11.2015 / 20:31

2 respostas

6

Da mesma página:

Parameter Syntax

Unit commands listed above take either a single unit name (designated as NAME), or multiple unit specifications (designated as PATTERN...). In the first case, [...]

In the second case, shell-style globs will be matched against currently loaded units; literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit names always refer to exactly one unit, but globs may match zero units and this is not considered an error.

Glob patterns use fnmatch(3), so normal shell-style globbing rules are used, and "*", "?", "[]" may be used. See glob(7) for more details. The patterns are matched against the names of currently loaded units, and patterns which do not match anything are silently skipped. For example:

# systemctl stop sshd@*.service

will stop all [email protected] instances.

    
por 12.11.2015 / 20:41
0

Parece que o asterisco deve ter um escape de shell

# systemctl stop sshd@\*.service
    
por 26.02.2017 / 23:27

Tags