summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-04-11 13:05:01 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-04-11 13:05:01 +0000
commitdda14271ad68f383af27bbbb5c448b9c0769195c (patch)
treeec0fb99b2c7ab43fa99aa2b97f38afcb0439202f /libexec
parentUpdating copyright in bash-completion, it got re-written from scratch years ago. (diff)
downloadcompute-tools-dda14271ad68f383af27bbbb5c448b9c0769195c.tar.xz
compute-tools-dda14271ad68f383af27bbbb5c448b9c0769195c.zip
Adding hook support to container log command for consistency.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/log20
1 files changed, 20 insertions, 0 deletions
diff --git a/libexec/container/log b/libexec/container/log
index 2378eb4..d0dc4af 100755
--- a/libexec/container/log
+++ b/libexec/container/log
@@ -24,6 +24,7 @@ SOFTWARE="compute-tools"
PROGRAM="container"
COMMAND="$(basename ${0})"
+HOOKS="/etc/${SOFTWARE}/hooks"
LOG="/var/log/${SOFTWARE}/${PROGRAM}.log"
Parameters ()
@@ -80,6 +81,16 @@ Usage ()
Parameters "${@}"
+# Pre hooks
+for FILE in "${HOOKS}/pre-${COMMAND}".*
+do
+ if [ -x "${FILE}" ]
+ then
+ "${FILE}"
+ fi
+done
+
+# Run
case "${DATE}" in
today-*)
DAYS="$(echo ${DATE} | awk -F- '{ print $2 }')"
@@ -142,3 +153,12 @@ do
;;
esac
done
+
+# Post hooks
+for FILE in "${HOOKS}/post-${COMMAND}".*
+do
+ if [ -x "${FILE}" ]
+ then
+ "${FILE}"
+ fi
+done