On 17/02/2012 15:01, no-re...@cfengine.com wrote:
> Forum: CFEngine Help
> Subject: Select files
> Author: skycoyotte
> Link to topic: https://cfengine.com/forum/read.php?3,24901,24901#msg-24901
>
> Hi
>
> I want to zeroing files bigger than 500 MB, on a signle directory.
> I wrote this agent :
>
> bundle agent garbage_collection
> {
> files:
>
>   any::
>
>
>    "/dir/to/watch/logs"
>
>      comment =>  "Empty files>  500MB",
>      file_select =>  data_log_size(".*","5000000","inf"),
>      depth_search =>  recurse("1"),
>      transformer =>  "/bin/dd if=/dev/zero of=$(this.promiser) bs=1 count=1";
>
> }
>
> body file_select data_log_size(a,b,c)
> {
>          leaf_name =>  { "$(a)" };
>          search_size =>  irange("$(b)", "$(c)");
>          file_types  =>  { "dir" };
>          file_result =>  "!file_types";
> }
>
Your file_result is incomplete. It should be :
file_result => "!file_types.leaf_name.search_size";

otherwise you are only taking the !file_type into acocunt

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

Reply via email to