Ubuntu/Linux: Detect if port is closed.

#!/bin/bash #exit #detect if port 11111 is open, if not do action: netstat -ln | grep ":11111 " 2>&1 > /dev/null if [ $? -eq 1 ]; then echo "Port is closed. Doing action..." fi
Bash script to make action in case port is closed.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.