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.

13

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.