isitup §

#!/bin/sh
# Author: prx <prx@si3t.ch>
# licence: MIT
# Check if $1 is reachable on port $2

help() {
    echo "usage: $0 <domain or IP> <port>"
    exit 1
}

test $# -eq 2 || help
nc -zw1 "${1}" "${2}"
    if [ $? -ne 0 ]; then
        printf "Connection to %s port %s failed 😨\n" "$domain" "$port"
        exit 1
    fi
exit 0