2017년 9월 20일 수요일

check if ip is open - nc

#!/bin/bash

nc -z $1 $2 1>/dev/null 2>&1; result=$?;
if [ $result -eq 0 ]; then
     echo 'the port is open for tcp connections'
else
     echo 'the port was closed'
fi

댓글 없음: