I just want to return true or false if a service is running. Here is where I'm at, not first try or last but current at writing:
service iptables status | grep -qi "not running"
The sdtout for service iptables status
when it's stopped is iptables: Firewall is not running
When I run what I came up with is nothing on a new line, which I guess is not unexpected as 0 is true and non-0 is false. So, I need to test to ensure it works, but I'm unsure what to do. Here is the try:
service iptables status | grep -qi "not running" || echo "stopped"
so when the service is stopped I expected to see stopped
but I didn't get anything but a new line.