isnewerthan
Table of contents
Prototype: isnewerthan(newer, older)
Return type: boolean
Description: Returns whether the file newer
is newer (modified later)
than the file older
.
This function compares the modification time (mtime) of the files. Note that access changes such as ownership and permissions as well as status changes such as last time the file was read are not included in the mtime timestamp.
Arguments:
newer
:string
- Newer file name - in the range:"?(/.*)
older
:string
- Older file name - in the range:"?(/.*)
Example:
Prepare:
code
touch -t '200102031234.56' /tmp/earlier
touch -t '200202031234.56' /tmp/later
Run:
code
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
classes:
"do_it" expression => isnewerthan("/tmp/later","/tmp/earlier");
reports:
do_it::
"/tmp/later is older than /tmp/earlier";
}
Output:
code
R: /tmp/later is older than /tmp/earlier
See also: accessedbefore()
, changedbefore()