|
|
Question : HP-UX: Korn Shell Script: Are the correct ports open?
|
|
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"`" = "" ] then echo "Port 80 open" else echo "Port 80 closed" fi
But this probably won't work if the port is acually open as telnet will block waiting for communication.
Any suggestions?
|
Answer : HP-UX: Korn Shell Script: Are the correct ports open?
|
|
ignition00
please change carefully...
..... if (a[m] == ports[i]) { print "port " a[m] " open" <-----------change this as well from a[2] to a[m] } .....
|
|
|
|