13

I check for a listening port on a service prior to running a script using this :

until nc -z $HOST $PORT
do
  echo "waiting for service to be available..."
  sleep 0.5
done

exec "/my/script"

It used to work with gnu-netcat, but now, I've upgraded the Linux distribution, and it uses nmap-ncat for the /usr/bin/nc command.

I'd like to know an equivalent solution to use with nmap-ncat package.

Enderson Maia
  • 231
  • 3
  • 7

1 Answers1

13

--send-only </dev/null seems to do the trick.

Jasen
  • 3,715
  • 13
  • 14