From 5d171d296278c80864f1545008f01c228a86939a Mon Sep 17 00:00:00 2001 From: gyurix Date: Thu, 21 Nov 2024 15:11:31 +0100 Subject: [PATCH] added inotify script --- scripts/scheduler/inotify.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/scheduler/inotify.sh diff --git a/scripts/scheduler/inotify.sh b/scripts/scheduler/inotify.sh new file mode 100644 index 0000000..6c2c8f3 --- /dev/null +++ b/scripts/scheduler/inotify.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# Initial parameters +DATE=$(date +%F-%H-%M-%S) + +# Set env variables +DIR=$DIR + +# Triggers by certificate or domain config changes + +unset IFS + +inotifywait --exclude "\.(swp|tmp)" -m -e CREATE,CLOSE_WRITE,DELETE,MOVED_TO -r $DIR | + while read dir op file; do + if [ "${op}" == "CLOSE_WRITE,CLOSE" ]; then + echo "new file created: $file" + fi + done