From dc44739bcf1b39eb12d4f8f9654e7785945c3490 Mon Sep 17 00:00:00 2001
From: John-Paul Robinson <jpr@uab.edu>
Date: Mon, 28 Feb 2022 11:09:33 -0600
Subject: [PATCH] Add list policy for 30day or older files

This is the policy run by the mmapplypolicy command.
---
 policy/list-30day-with-excludes | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 policy/list-30day-with-excludes

diff --git a/policy/list-30day-with-excludes b/policy/list-30day-with-excludes
new file mode 100644
index 0000000..ac3cb5b
--- /dev/null
+++ b/policy/list-30day-with-excludes
@@ -0,0 +1,26 @@
+/* list of files to exclude */
+define( exclude_list,
+  (PATH_NAME LIKE '%.oldscratch/%')
+)
+
+/* define access_age */
+define(access_age,
+  (DAYS(CURRENT_TIMESTAMP) - DAYS(ACCESS_TIME))
+)
+
+/* note: subtitution via -M for file tag */
+RULE 'old_files' LIST 'FILETAG'
+  SHOW ('|size='   || varchar(FILE_SIZE) ||
+        '|kballoc='|| varchar(KB_ALLOCATED) || 
+        '|access=' || varchar(ACCESS_TIME) ||
+        '|create=' || varchar(CREATION_TIME) ||
+        '|modify=' || varchar(MODIFICATION_TIME) ||
+	'|uid='    || varchar(USER_ID) ||
+        '|gid='    || varchar(GROUP_ID) ||
+        '|heat='   || varchar(FILE_HEAT) ||
+        '|pool='   || varchar(POOL_NAME) ||
+        '|path='   || varchar(PATH_NAME) ||
+        '|'
+       )
+  WHERE access_age > 30 AND NOT exclude_list
+
-- 
GitLab