Forum: CFEngine Help
Subject: Re: filecopy, transform with grep.
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,22985,22987#msg-22987

One approach pop up in my mind after finishing reading.

body common control
{
 bundlesequence => { "test" };
 inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" };
}

bundle agent test
{
 classes:
  "no_resultfile" not => fileexists("/path/to/resultfile");

 files:
  no_resultfile::
   "/tmp/sourcefile"
      copy_from => local_cp("/path/to/sourcefile");
      edit_line => delete_lines_matching(".*$(sys.uqhost).*"),
      classes => if_repaired("do_update");

  do_update::
   "/path/to/resultfile"
      copy_from => local_cp("/tmp/sourcefile"),
      classes => if_repaired("clear_tmp");

  clear_tmp::
   "/tmp/sourcefile.*"
      delete => tidy;
}


Cheers,
--Nakarin

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

Reply via email to