help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing for file age


From: Atom Powers
Subject: Re: Testing for file age
Date: Tue, 14 Feb 2006 10:07:09 -0800

On 2/13/06, John van Zantvoort <snl.jydawg@gmail.com> wrote:
>  I'd like to test for a files mtime to define a class so if e.g. the
> /var/lib/slocate/slocate.db file is more then 4 days of define the class
> run_updatedb. but I've not been able to find such a function within
> cfengine.
>

This is kind of a long way to do it, but it should work
--
control:
  agedfiles = ( ExecResult(/usr/bin/find ${path_to_files} -ctime
+${maximumage}) )
classes:
  filesareold = (Strcmp(${agedfiles},"") )
alerts:
  filesareold::
    "Warning: ${path_to_files} are older than ${maximumage}"
--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]