Snort mailing list archives

init script status check always exits zero


From: "Josh Kline" <snort-devel () track jonfram net>
Date: Wed, 28 Jan 2015 20:33:26 -0800

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



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Snort-devel mailing list
Snort-devel () lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/snort-devel
Archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-devel

Please visit http://blog.snort.org for the latest news about Snort!


Current thread: