#!/bin/bash sleep 1 echo "sync_barrier_start" nc -u 127.13.3.7 5000 --sh-exec 'while true; do sleep 1; echo a; done' & CAPTURE=$! nc -ul 127.0.0.1 5000 --exec /bin/true echo "sync_barrier_release" sleep 1 kill $CAPTURE sleep 10 echo "sync_barrier_done"