HP Superdome: HP-UX: Korn Shell:
I am building some enviroment validation scripts for this box in KSH.
I need a way of checking if the required ports are opened so that I would run a script and it would return output such as:
Port 80 is open
Port 22 is open
Port 58 is not open
I thought about something like this:
if [ "`telnet localhost 80 | grep "telnet: connect to address 127.0.0.1: Connection refused"`" = "" ]
echo "Port 80 open"
echo "Port 80 closed"
But this probably won't work if the port is acually open as telnet will block waiting for communication.