Forum: Cfengine Help
Subject: backgrounding methods
Author: matter
Link to topic: https://cfengine.com/forum/read.php?3,18002,18002#msg-18002

Greetings,

Is it possible to background a whole method? For example, I would like to copy 
files from several hosts and background each host's copies separately. Below is 
a sample which does not seem to work as desired, it does the hosts serially.


##########################################################################

body common control {

    bundlesequence => { "test" };
}


##########################################################################

body agent control {

   maxconnections => "1000";
   max_children      => "10";

}

##########################################################################


bundle agent test {

   vars:

     "hosts" slist => { "serverA","serverB","serverC" };

   methods:

      "any" usebundle => host_copy("$(hosts)"),
          comment   => "do a single host",
          action        => background;

}
##########################################################################

bundle agent host_copy(host) {

   files:

     "/tmp/foo/$(host)"
        comment      => "copy all files in client's directory",
        copy_from    => server_copy("/var/cfengine/inputs","$(host)"),
        depth_search => recurse("inf");
}

##########################################################################

body action background {

   background => "true";

}

##########################################################################

body copy_from server_copy(from,server)
{
  servers       => { "$(server)" };
  source        => "$(from)";
  portnumber    => "5308";
  trustkey      => "true";
  copy_backup   => "false";
  purge         => "true";
  encrypt       => "true";
}

##########################################################################

body depth_search recurse(d)
{
  depth => "$(d)";
}

##########################################################################

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to