#!/bin/bash USERS_FILE="./api_v1/users.json" # Legge ogni utente dal JSON for user in $(jq -r '.users[].name' "$USERS_FILE"); do # Determina la cartella da monitorare if [[ "$user" == "Admin" ]]; then WATCH_DIR="./public/photos/Common/original" else WATCH_DIR="./public/photos/$user/original" fi echo "Monitoro con inotifywait: $WATCH_DIR per utente $user" # Avvia watcher per ogni utente in background inotifywait -m -r -e close_write,moved_to,moved_from,delete "$WATCH_DIR" \ | node watcher_logic3.mjs "$user" & done wait