I need check port on the remote server in bash script before script will continue. I search here and on the internet, but I can´t find answer which works for me.
I´m using RHEL 7.2 virtual machine so I don´t have -z
parameter in nc
command or /dev/tcp/
thing.
Also nc remote.host.com 1284 < /dev/null
don´t work, because every time I get exit code 1.
Basically I need something like that:
/bin/someting host port
if [ $? -eq 0 ]; then
echo "Great, remote port is ready."
else
exit 1
fi