#!/usr/bin/env bash
set -Eeuo pipefail
UPLOAD_ROOT="/opt/rustypaste/upload"

exec inotifywait --monitor --recursive --quiet --format '%w%f' \
  --event close_write,moved_to "$UPLOAD_ROOT" |
while IFS= read -r file; do
  /usr/local/sbin/rustypaste-clamav-scan "$file" &
done
