www.delorie.com/gnu/docs/cfengine/cfengine-Reference_5.html   search  
 
Buy GNU books!


GNU cfengine

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 Evaluated classes

Cfengine provides a number of in-built functions for evaluating classes, based on file tests. Using these internal functions is quicker than calling the shell test function. The time functions place their arguments in chronological order.

IsNewerThan(f1,f2)
True if file 2 is modified more recently than file 1. (mtime)
AccessedBefore(f1,f2)
True if file 1 had its last access earlier than file 2 (atime)
ChangedBefore(f1,f2)
True if file 1's attributes were changed in any way before file 2's (ctime).
FileExists(file)
True if the named file object exists.
IPRange(address-range)
True if the current host lies within the specified range
IsDefined(command)
True of the named variable is defined. NB: IsDefines(var), not IsDefined(${var})
IsDir(f)
True if the named file object is a directory.
IsLink(f)
True if the named file object is a symbolic link.
IsPlain(f)
True if the named file object is a plain file.
ReturnsZero(command)
True if the named shell command returns with exit code zero (okay).
Strcmp(s1,s2)
True if the strings match exactly.

For example:
 
classes:

 access_to_dir = ( ReturnsZero(/bin/cd /mydir) )
 compare       = ( ChangedBefore(/etc/passwd_master,/etc/passwd) )
 isplain       = ( IsPlain(/tmp/import) )
 inrange       = ( IPRange(128.39.89.10-15) )
 CIDR          = ( IPRange(128.39.89.10/24) )


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003