79105741

Date: 2024-10-19 19:23:07
Score: 1
Natty:
Report link

Use nc utility for that, smth like

    # After hostname, the port can be specified
    # Let's set connection timeout to 1 sec
    if nc -zw1 $hostname >/dev/null 2>&1
    then
        echo "'$hostname' is reachable!"
    fi
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: arcadius