I am trying to obtain the status of a httpd service with Centos 7. I want to know if i can print only the value of Active, that in this example is inactive (dead)
This is the command that i am using:
[root@localhost ~]# service httpd status | grep Active
This is the result of that command.
Redirecting to /bin/systemctl status httpd.service
Active: inactive (dead)
This is the output that ia want: inactive (dead).
也许是这样的:
/bin/systemctl status httpd.service | grep -o "\w*ctive "
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.