[ajug-members] checking for server availability
Sony Antony
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 )
==============START
#!/bin/ksh
telnet $1 $2 >/tmp/checkFireWall.$$ 2>&1 &
sleep 10
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"
else
print "Firewall going to host: $1 Port:$2"
fi
rm /tmp/checkFireWall.$$
kill -9 $! >/dev/null 2>&1
===========END
--sony
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.
>
>
>
> Thanks
>
> Mike Barnes
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
>
>
More information about the ajug-members
mailing list