[Snort-devel] init script status check always exits zero

Josh Kline snort-devel at ...3556...
Wed Jan 28 23:33:26 EST 2015


It is my understanding that when asked to check status of a service an
init script should exit zero only when the service is running.

http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

The Chef configuration management tool, for example, relies on this
behavior in order to conditionally start a service.
http://serverfault.com/questions/495969/service-doesnt-start-when-using-chef
There is a work-around,
http://lists.opscode.com/sympa/arc/chef/2012-02/msg00270.html

Currently `/etc/init.d/snortd status` always exits 0, regardless if snort
daemon is running, because it ignore the return value of the status
function.

I am running version 1:2.9.7.0-1 of your snort.x86_64 rpm package.

Applying the following patch fixed the problem for me:

--- snortd.orig 2015-01-29 03:56:04.800894066 +0000
+++ snortd  2015-01-29 03:56:26.381132577 +0000
@@ -140,6 +140,8 @@
         ;;
   status)
         status snort
+        RETVAL=$?
+        exit $RETVAL
         ;;
   stats)
         TC=125                          # Trailing context to grep



Thank you for your attention and for your work producing the Snort tool.

Sincerely,
Josh Kline






More information about the Snort-devel mailing list