2017-05-05 11 views
0

Centos 7でhttpdサービスのステータスを取得しようとしています。 Activeの値だけを印刷できるかどうかを知りたい場合、この例では無効です死んだ)コマンドの結果の一部のみを出力する

これは私が使用していますコマンドです:

[[email protected] ~]# service httpd status | grep Active 

これは、そのコマンドの結果です。

Redirecting to /bin/systemctl status httpd.service 
     Active: inactive (dead) 

これは私が望む出力です:非アクティブ(死んでいる)。

答えて

0

たぶん、このような何か:

/bin/systemctl status httpd.service | grep -o "\w*ctive " 
関連する問題