photo_server_json_flutter_c.../www.sh
2026-03-23 12:31:01 +01:00

22 lines
582 B
Bash

#!/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_logic2.mjs "$user" &
done
wait