/etc/init.d/suricata status always returns 0
According to LSB specification status 0 is returned if the service is ok. But right now /etc/init.d/suricata status always returns 0
For my use case I just need a different value of 0 if something is not ok.
Updated by Miguel Angel Cabrera Moya almost 7 years ago
I installed the package for Ubuntu 14.04 (Ubuntu Trusty) from this ppa https://launchpad.net/~oisf/+archive/ubuntu/suricata-beta/
Updated by Jason Ish almost 7 years ago
Peter asked me on IRC what the behaviour was like on Fedora/CentOS, as he wasn't around when I was able to answer I thought I would provide the answer here.
The RPMs no longer install anything in /etc/init.d, but you can use systemctl state suricata. If Suricata is running, systemctl will return 0, if Suricata is not running, systemctl status will return 3.
You can also use "service status suricata", that just forwards the request to systemctl and returns the same as systemctl status.
Updated by Peter Manev almost 7 years ago
Apparently this is not true for Ubuntu/Debian for a number of valid reasons (with the later actually dropped the LSB support as of July 2015)
It seems Debian/Ubuntu have some deviations in the intention/rationale of the init script return codes.