Forum: CFEngine Help
Subject: Re: garbage collection - not deleting all files
Author: hristob
Link to topic: https://cfengine.com/forum/read.php?3,23905,23907#msg-23907

Of course I could...


-rw------- 1 root root 15050 Nov  7 11:08 cfengine_stdlib.cf
-rw-r--r-- 1 root root   327 Nov  7 11:12 delete.cf
-rw-r--r-- 1 root root     0 Oct  7 10:00 lastm.tmp
-rw-r--r-- 1 root root     0 Nov  7  2010 lasty.tmp
-rw-r--r-- 1 root root     0 Nov  7 11:03 today.tmp
# cf-agent -vf ./delete.cf |less
# cf-agent -KIvf ./delete.cf |less
# vi delete.cf
# cf-agent -KIvf ./delete.cf
.....
community> Cfengine - 3.1.4 Copyright (C) Cfengine AS 2008,2010-
.....
community>     .........................................................
community>     Promise handle:
community>     Promise made by: /tmp/testdelete
community>
community>     Comment:  Garbage collection of any output files
community>     .........................................................
community>
community>  -> Using literal pathtype for /tmp/testdelete
community>  -> Handling file existence constraints on /tmp/testdelete/lastm.tmp
community>  -> Verifying file deletions for /tmp/testdelete/lastm.tmp
community>  -> Deleted file /tmp/testdelete/lastm.tmp
community>
community>      +  Private classes augmented:
community>
community>      -  Private classes diminished:
community>
community>
community>
community>    =========================================================
community>    files in bundle garbage_collection (2)
community>    =========================================================
community>
community>
community>      +  Private classes augmented:
community>
community>      -  Private classes diminished:
community>
community>
community>
community>    =========================================================
community>    files in bundle garbage_collection (3)
community>    =========================================================
community>
community> Outcome of version (not specified) (agent-0): Promises observed to 
be kept 0%, Promises repaired 100%, Promises not repaired 0%
community> Estimated system complexity as touched objects = 1, for 1 promises
community>  -> Writing last-seen observations
community>  -> Keyring is empty
community>  -> No lock purging scheduled
# ll
total 20
-rw------- 1 root root 15050 Nov  7 11:08 cfengine_stdlib.cf
-rw-r--r-- 1 root root   321 Nov  7 11:14 delete.cf
-rw-r--r-- 1 root root     0 Nov  7  2010 lasty.tmp
-rw-r--r-- 1 root root     0 Nov  7 11:03 today.tmp


 cat delete.cf

body common control
{
bundlesequence => { "garbage_collection" };
inputs => { "cfengine_stdlib.cf" };
}


bundle agent garbage_collection
{
files:

  "/tmp/testdelete"

    comment => "Garbage collection of any output files",
    delete => tidy,
    file_select => days_old("3"),
    depth_search => recurse("inf");


}




As you can see last month file is erased, but no last year.

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

Reply via email to