Forum: Cfengine Help
Subject: Re: cf-runagent unable to background and ignoring -s
Author: kholloway
Link to topic: https://cfengine.com/forum/read.php?3,18529,18546#msg-18546

Excellent! :)

Here is my solution until -s is implemented/fixed, it's not perfect and could 
certainly be done any number of other ways.
Self contained, should be able to just run it with the -f option to runagent.
Populate the file /tmp/cfrun_host_list with a single host per line, you could 
get fancy about how you generate this file if you have an inventory system or 
LDAP or whatever but either way it works as expected when the file has valid 
host names.

body common control
{
        bundlesequence => { "g" };
        version => "1.0";
}

bundle common g
{
        vars:
         policyhost::
          "runagent_host_list"  slist => { 
readstringlist("/tmp/cfrun_host_list","#.*","[\n]",3000,10000) };

        classes:
         policyhost::
          "runagent_hosts"      expression => isvariable("runagent_host_list");
}

body runagent control 
{
        max_children            => '50';
        background_children     => "true";
        runagent_hosts::
                hosts                   => { @{g.runagent_host_list} };
}

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

Reply via email to