Usage: checkport <hostname or IP> <Port No.>
#!/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 is closed' fi
Using telnet `telnet <host_or_ip> <port>' will do the job, but it doesn't leave room for automation, so this script is better alternative.
No comments:
Post a Comment
Hi, Leave a comment here and one of the binary piper's will reply soon :)