[ajug-members] checking for server availability
sony.antony at gmail.com
Fri Apr 6 11:18:17 EDT 2007
Following ksh script merely checking if a TCP listener exists at a
given port. It also checks if there is a firewall between the client
and server ( you might not need that )
telnet $1 $2 >/tmp/checkFireWall.$$ 2>&1 &
if grep Connected /tmp/checkFireWall.$$ >/dev/null ; then
print "No Firewall and able to connect to host: $1 Port:$2"
elif grep Unable /tmp/checkFireWall.$$ >/dev/null ; then
print "No Firewall. But No listener at host: $1 Port:$2"
print "Firewall going to host: $1 Port:$2"
kill -9 $! >/dev/null 2>&1
On 4/6/07, Barnes, Mike <mike.barnes at cingular.com> wrote:
> Is there a way to ping a host/port to see if it is available? I need to set
> up a heartbeat process and would like to do it as cheaply as possible
> (network time). The current way we are doing this is to send a known message
> to the server and wait for a response, I am not sure that this is the best
> way to check if a server is up or not.
> Mike Barnes
> ajug-members mailing list
> ajug-members at ajug.org
More information about the ajug-members