Forum: Cfengine Help
Subject: Re: cf-runagent ignores max_children parameter
Author: Seva Gluschenko
Link to topic: https://cfengine.com/forum/read.php?3,17639,17642#msg-17642

Well, so that I suggest you the following patch which is proven to be working 
in my environment:

--- src/runagent.c.orig 2010-07-06 16:07:21.692445121 +0400
+++ src/runagent.c      2010-07-06 16:55:03.856428596 +0400
@@ -57,9 +57,10 @@
             "The latter type is regulated by cf-serverd's role based\n"
             "access control.";
  
- struct option OPTIONS[15] =
+ struct option OPTIONS[16] =
       {
       { "help",no_argument,0,'h' },
+      { "background",optional_argument,0,'b' },
       { "debug",optional_argument,0,'d' },
       { "verbose",no_argument,0,'v' },
       { "dry-run",no_argument,0,'n'},
@@ -79,6 +80,7 @@
  char *HINTS[15] =
       {
       "Print the help message",
+      "Parallelize connections (50 by default)",
       "Set debugging level 0,1,2,3",
       "Output verbose information about the behaviour of the agent",
       "All talk and no action mode - make no changes, only inform of promises 
not kept",
@@ -159,7 +161,7 @@
 DEFINECLASSES[0] = '\0';
 SENDCLASSES[0] = '\0';  
   
-while ((c=getopt_long(argc,argv,"q:d:vnKhIif:D:VSxo:s:MH:",OPTIONS,&optindex)) 
!= EOF)
+while 
((c=getopt_long(argc,argv,"q:b:d:vnKhIif:D:VSxo:s:MH:",OPTIONS,&optindex)) != 
EOF)
   {
   switch ((char) c)
       {
@@ -169,6 +171,12 @@
           MINUSF = true;
           break;
 
+      case 'b':
+          BACKGROUND = true;
+          if (optarg)
+              MAXCHILD = atoi(optarg);
+          break;
+
       case 'd': 
           NewClass("opt_debug");
           switch ((optarg==NULL) ? '3' : *optarg)
@@ -474,6 +482,18 @@
       continue;
       }
 
+   if (strcmp(cp->lval,CFR_CONTROLBODY.lval) == 0)
+      {
+      BACKGROUND = GetBoolean(retval);
+      continue;
+      }
+
+   if (strcmp(cp->lval,CFR_CONTROLBODY.lval) == 0)
+      {
+      MAXCHILD = (short)Str2Int(retval);
+      continue;
+      }
+
    
    if (strcmp(cp->lval,CFR_CONTROLBODY.lval) == 0)
       {


Worth mentioning, I've added -b option which allows to specify background mode 
using command line. I kept the default max_children of 50, but it can be 
overridden, both from body control runagent, and using -b number.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to