Bug #1610
closed/etc/init.d/suricata status always returns 0
Description
According to LSB specification status 0 is returned if the service is ok. But right now /etc/init.d/suricata status always returns 0
https://refspecs.linuxbase.org/LSB_3.1.0/LSB-generic/LSB-generic/iniscrptact.html
For my use case I just need a different value of 0 if something is not ok.
Updated by Miguel Angel Cabrera Moya about 9 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 Victor Julien about 9 years ago
- Status changed from New to Assigned
- Assignee set to Peter Manev
- Target version set to Packaging/PPA
Updated by Peter Manev about 9 years ago
Interesting - the init script is very similar to the one in Debian.
I will update once I do some more investigation.
Updated by Jason Ish about 9 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 about 9 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)
Ref and background:
https://en.wikipedia.org/wiki/Linux_Standard_Base#Limitations_on_Debian
https://wiki.debian.org/LSBInitScripts
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208010
It seems Debian/Ubuntu have some deviations in the intention/rationale of the init script return codes.