I am getting dhcp server status using
service dhcpd status
. Result is
Redirecting to /bin/systemctl status dhcpd.service ● dhcpd.service - DHCPv4 Server Daemon Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
Active: active (running) since......
I just want to extract active
and send to php (Zend) server. To do it, I used
service dhcpd status | awk '{for (I=1;I<=NF;I++) if ($I == "Active:") {print $(I+1)};}'
Result is
Redirecting to /bin/systemctl status dhcpd.service
active
I just don't understand how to remove Redirecting to /bin/systemctl status dhcpd.service part from the result.
I have tried these answers, but they were not addressing my issue.
Am I missing something? or is there a better way to do it? I am not familiar with shell scripts.
Thanks in advance.