Inotify trigger change to CLOSE_WRITE,CLOSE only

This commit is contained in:
2021-05-16 11:46:41 +02:00
parent 02b24ca2bf
commit d65fd605df

View File

@@ -7,11 +7,11 @@ service_exec=echo
CERT_DIR=/keys CERT_DIR=/keys
inotifywait --exclude .swp -m -e modify,create -r $CERT_DIR | \ inotifywait --exclude .swp -m -e CLOSE_WRITE,CLOSE -r $CERT_DIR | \
while read dir op file while read dir op file
do do
if [[ "${op}" == "CLOSE_WRITE,CLOSE" || "${op}" == "CREATE" ]] ; then if [[ "${op}" == "CLOSE_WRITE,CLOSE" ]] ; then
DOMAIN=$(echo $dir|cut -d / -f3) DOMAIN=$(echo $dir|cut -d / -f3)
FILE=$(find /etc/user/config/services/ -name *.json | xargs -I {} jq '{"file": input_filename, "MAIN": ..|.main?'} {} | jq -c 'select(.MAIN | length > 0)' | grep $DOMAIN | jq -r .file) FILE=$(find /etc/user/config/services/ -name *.json | xargs -I {} jq '{"file": input_filename, "MAIN": ..|.main?'} {} | jq -c 'select(.MAIN | length > 0)' | grep $DOMAIN | jq -r .file)