我想获得所有匹配模式的服务名称。
这不起作用:
systemctl list-units -t service --no-pager --no-legend| cut -d' ' -f1| grep mypattern
长服务名称被削减。
例:
[email protected]
我如何列出整个单元名称?
您需要使用--full选项:
不要在列表单元和列表作业的输出中省略单位名称和截断单位描述。
这是整个脚本:
systemctl list-units -t service --full| cut -d' ' -f1| grep mypattern | while read s; do systemctl status $s; done