Forum: CFEngine Help
Subject: Re: Select files
Author: skycoyotte
Link to topic: https://cfengine.com/forum/read.php?3,24901,24951#msg-24951
Hi,
I tried the debug mode.
There are many lines !
At this point, i have no idea about my trouble.
I tried to use different unit like '50m' or '50000' for the minimal irange
value.... but nothing to do.
I think there is a mistake with the file_result value, but i can't say more
than that.
I attach my promise to this post.
If anybody have an idea, i'll be happy. I don't know how to write my promise in
another way.
Regards
##################################################################################
body common control
{
bundlesequence => {
"garbage_collection"
};
inputs => {
"/var/cfengine/inputs/cfengine_stdlib.cf"
};
version => "1.0.0";
}
bundle agent garbage_collection
{
files:
any::
"/appli/prod/jakarta-tomcat/logs"
comment => "Nettoyage du dossier de log de tomcat / fichier de + de 500Mo",
file_select => data_log_size(".*","50000","inf"),
depth_search => recurse("1"),
transformer => "/bin/ls $(this.promiser)";
}
body file_select data_log_size(a,b,c)
{
leaf_name => { "$(a)" };
search_size => irange("$(b)", "$(c)");
file_types => { "dir" };
file_result => "!file_types.leaf_name.search_size";
}
##################################################################################
output of ls command (there are 2 files and 1 subdir)
ALPHA-1:/var/cfengine/spir # ls -lh /appli/prod/jakarta-tomcat/logs
total 635M
-rw-r--r-- 1 root root 577M Feb 17 14:38 bigfile
-rw-r--r-- 1 root root 58M Feb 17 14:37 bigfile2
drwxr-xr-x 2 root root 4.0K Feb 16 16:25 dir
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine