#!/bin/bash WATCHDIR="$HOME/sync/work/Code/CSharp/git_trunk/csharp/App/GrowattCommunication/bin/Release/net6.0/linux-arm64/publish" DEST="ubuntu@91.92.155.224:/home/ubuntu/Releases" echo "👀 Watching for real releases in $WATCHDIR..." inotifywait -m -e close_write --format '%w%f' "$WATCHDIR" | while read file; do filename="$(basename "$file")" if [[ "$filename" == ".release.flag" ]]; then echo "🚀 Release flag detected. Syncing full release to $DEST..." rm "$file" rsync -avz \ --exclude '*.pdb' \ "$WATCHDIR/" "$DEST/" echo "✅ Sync completed and flag cleared." fi done