Last active
January 17, 2023 10:49
-
-
Save yazanmonshed/e226bde900fce6a5ce366f5297cc6bf9 to your computer and use it in GitHub Desktop.
Check remote ports from Jenkins Bypassing the IP & Port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the server address and port number, Ex (Pass by Jenkins as a parameter’s) | |
server=$1 | |
port=$2 | |
# Check if the port is open | |
nc -v -z $server $port | |
if [ $? -eq 0 ]; then | |
echo "Port $port is open on $server." | |
else | |
echo "Port $port is closed on $server." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment