getent hosts <dns>timeout 5 bash -c '</dev/tcp/<host>/<port>' && echo OK || echo KONote: only if bash is available.
curl --connect-timeout 5 telnet://<host>:<port> && echo OK || echo KOtimeout 5 openssl s_client -connect <host>:<port> </dev/null 2>/dev/null \
&& echo OK || echo KO