Skip to content

Instantly share code, notes, and snippets.

@yazanmonshed
Last active January 17, 2023 10:49
Show Gist options
  • Save yazanmonshed/e226bde900fce6a5ce366f5297cc6bf9 to your computer and use it in GitHub Desktop.
Save yazanmonshed/e226bde900fce6a5ce366f5297cc6bf9 to your computer and use it in GitHub Desktop.
Check remote ports from Jenkins Bypassing the IP & Port
#!/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