diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2021-04-11 13:05:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2021-04-11 13:05:01 +0000 |
commit | dda14271ad68f383af27bbbb5c448b9c0769195c (patch) | |
tree | ec0fb99b2c7ab43fa99aa2b97f38afcb0439202f /lib | |
parent | Updating copyright in bash-completion, it got re-written from scratch years ago. (diff) | |
download | compute-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-x | libexec/container/log | 20 |
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 |