Skip to content

Instantly share code, notes, and snippets.

@willis7
Created July 4, 2018 06:39
Show Gist options
  • Save willis7/dc280cc80f341a797ab3aae1e0e0c598 to your computer and use it in GitHub Desktop.
Save willis7/dc280cc80f341a797ab3aae1e0e0c598 to your computer and use it in GitHub Desktop.
“check that we can connect to a remote server on a particular port” Excerpt From: Lorin Hochstein. “Ansible.”
#!/bin/bash
#
# Usage:
# $ “can_reach.sh www.example.com 80 1”
host=$1
port=$2
timeout=$3
nc -z -w $timeout $host $port”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment