Fresh Files Macro
The fresh_files_alarms_macros.cfg is a script macro to report fresh, or updated, files.
fresh_files(DIR, FILTYP, TYP, EXT, DAYS, BYPASS1, BYPASS2) init status =piktstatus level =piktlevel task "Report any recently updated (FILTYP) files" // currently, only show files d days old or less; // for finer granularity, with precision to hours or minutes, // we would have to code a much more complex script input proc "=find (DIR) (TYP) -name \\*.(EXT) -mtime -(DAYS) -exec ls -ld {} \\; 2>/dev/null" rule if $inline =~~ "(BYPASS1)" next endif rule if $inline !~~ "(BYPASS2)" output mail $inlin endif end quit
You might invoke the =fresh_files() macro in your alarms.cfg file thusly:
ACMEDATFreshFiles =fresh_files(=acmedatdir, ACME DAT, -type f, dat, 1, ocs\.dat|iss\.dat|mss\.dat|kic\.dat, =nonesuch)
Output from the ACMEDATFreshFiles script might look like, for example:
NOTICE: ACMEDATFreshFiles Report any recently updated ACME DAT files -rw-r--r-- 1 acme coders 30115 Sep 12 08:44 /usr/local/acme/data/vps.dat -rw-r--r-- 1 acme coders 381048 Sep 12 02:18 /usr/local/acme/data/mss.dat
For more examples, see Samples.