Check URL with ksh

Hi everybody,

I'm currently writing a ksh script which automates the entire startup of a large number of Tibco BusinessWorks domains, as well as all the deployed components running on it.

My script is to be used after an infrastructure release, when the entire environement is down. It takes in account the load on each server, and will intelligently start up the components accordingly.

There is one last thing I need to do however. Before starting up the components, I need to make sure that at least one web server, hosting the dynamic config files for the components, is up. The web servers are attached to a VIP on the content switch, so I only need to test one URL.

I would like to get the http response code to determine whether the web server is working or not. I've done this before using lynx, but on my Solaris 10 system, there are no text browsers installed.

Can anyone help me out to find an alternative ksh solution on solaris 10?

Thanks,

Bart.

If you have ksh93 installed you can use file redirection to test if a connection is up. From the ksh93 man page:

In each of the following redirections, if file is of the
form /dev/sctp/host/port, /dev/tcp/host/port, or
/dev/udp/host/port, where host is a hostname or host
address, and port is a service given by name or an integer
port number, then the redirection attempts to make a tcp,
sctp or udp connection to the corresponding socket.

Alternatively how about using wget? It is on the Companion CD as SUNWwgetr