File Age Limits
This fileages_objects.cfg example specifies file age limits, or modification times beyond which a file is considered to be out of date. This objects file might be referenced by a Pikt script such as FileUpdates.
Note in this example the use of virtual #include files by means of the '#include [<proc>]' directives. An excerpt from the logs_system_objects.cfg file might show:
// macroname filepath days secs binary maxsize preproc postproc syslog /var/log/messages 0 10800 0 10000 . .
In the fileages_objects.cfg file below, the awk statement in the #include directive says to fetch just the 2nd, 3rd, 4th, and 5th fields (filepath, days, secs, binary) for the purpose of setting file age limits.
Why this virtual #include file trickery? The idea is so that we don't have to duplicate information. Specify file (or directory or ...) attributes once in one .cfg file, then grab bits and pieces of those specifications for other purposes by means of virtual #include files.
/////////////////////////////////////////////////////////////////////////////// // // fileages_objects.cfg // /////////////////////////////////////////////////////////////////////////////// FileAges // for FileAges, the number is the file age, either in days or in seconds, // beyond which a file is considered to be out of date // all numeric fields must be actual numbers, not e.g., 2*60*60, but // rather 7200 // file days secs binary /////////////////////////////////////////////////////////////////////////////// // log stuff #include [/pikt/bin/pikts </pikt/lib/configs/objects/adm/logs_system_objects.cfg | awk '/^#/ {print; next}; /^[A-Z]/ {print " "; next}; {print $2 " " $3 " " $4 " " $5}'] #include [/pikt/bin/pikts < /pikt/lib/configs/objects/adm/logs_pikt_objects.cfg | awk '/^#/ {print; next}; /^[A-Z]/ {print " "; next}; {print $2 " " $3 " " $4 " " $5}'] #include [/pikt/bin/pikts < /pikt/lib/configs/objects/adm/logs_local_objects.cfg | awk '/^#/ {print; next}; /^[A-Z]/ {print " "; next}; {print $2 " " $3 " " $4 " " $5}'] /////////////////////////////////////////////////////////////////////////////// // system stuff follows /////////////////////////////////////////////////////////////////////////////// // pikt stuff follows #include <objects/adm/fileages_pikt_objects.cfg> /////////////////////////////////////////////////////////////////////////////// // local stuff follows #include <objects/adm/fileages_local_objects.cfg> ///////////////////////////////////////////////////////////////////////////////
On the piktmaster system, we would install the FileAges.obj file to each PIKT slave system with the command:
# piktc -iv +O FileAges +H all [or: ... -H down]
For more examples, see Samples.