Argus as a daemon: initscripts broken

Chris Wilson chris-argus at qwirx.com
Sun Sep 20 18:18:39 EDT 2009


Hi all,

It seems that the default behaviour of "argus -d" has changed. While this 
option used to force Argus to run as a daemon, overriding the setting in the 
configuration, it now toggles the value.

As the default initscript runs Argus with -d, and the default configuration 
file also specified ArgusDaemon = yes, the end result is that by default, 
running "/etc/init.d/argus start" runs Argus in the foreground, not as a 
daemon, and therefore never finishes. This also causes "rpm -ivh 
argus-3.0.0.i386.rpm" to hang forever when it tries to start the daemon.

The attached patch makes the -d option always cause Argus to run as a daemon, 
and adds a new option, -f, which forces it to run in the foreground. This fixed 
both the initscript and RPM installation problems described above.

Cheers, Chris.
-- 
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <chris+sig at qwirx.com> Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
\__/_/_/_//_/___/ | We are GNU : free your mind & your software |
-------------- next part --------------
diff -ru argus-3.0.0/argus/argus.c argus-3.0.0-chris/argus/argus.c
--- argus-3.0.0/argus/argus.c	2008-03-15 21:02:03.000000000 +0000
+++ argus-3.0.0-chris/argus/argus.c	2009-09-20 23:13:18.000000000 +0100
@@ -298,7 +298,7 @@
 
    optind = 1, opterr = 0;
 
-   while ((op = getopt (argc, argv, "AbB:c:dD:e:F:g:i:JmM:N:OP:pRr:S:stT:u:U:w:XZh")) != EOF) {
+   while ((op = getopt (argc, argv, "AbB:c:dD:e:fF:g:i:JmM:N:OP:pRr:S:stT:u:U:w:XZh")) != EOF) {
       switch (op) {
          case 'A': setArgusAflag(ArgusModel, 1); break;
          case 'b': setArgusbpflag (ArgusSourceTask, 1); break;
@@ -308,7 +308,8 @@
                 ArgusLog (LOG_ERR, "strdup %s", strerror(errno));
             break;
 
-         case 'd': daemonflag = daemonflag ? 0 : 1; break;
+         case 'd': daemonflag = 1; break;
+         case 'f': daemonflag = 0; break;
          case 'D': setArgusdflag (ArgusModel, atoi (optarg)); break;
          case 'e': ArgusParseSourceID(ArgusModel, optarg); break;
 


More information about the argus mailing list