systemctl: 認識できないオプション '--value'

systemctl: 認識できないオプション '--value'

systemctlコマンドを使用して属性値のみを取得します。そして、次のコマンドを実行します。

systemctl show -p ActiveState --value servicename

次のエラーが発生します。

systemctl: unrecognized option '--value'

私のシステムはCentOS Linuxバージョン7.9.2009(コア)、systemctl --versionsystemd 219です。

ベストアンサー1

--valueこれはsystemd 230に追加されましたしたがって、systemd 219では使用できず、値を直接解析する必要があります。

# systemctl show -p ActiveState firewalld | cut -d"=" -f2
active

おすすめ記事