Babar Haq

Saturday, May 27, 2006

Checking network connectivity from a linux box

I wrote a small bash script to check network connectivity from a linux box using ping. This solutions is available over the net so I am just reiterating it.

#!/bin/bash
if ( ping -c 1 -w 1 hostname/ip) &>/dev/null; then
echo "hostname/ip is up"
else
echo "hostname/ip is down"
fi

All you have to do is replace the hostname/ip with the system to whom you want to check your network connectivity. Beware! if you are using hostname, the ping will show the host down, even if it cannot resolve the hostname.

Tuesday, May 23, 2006

Apache compiled in modules

A couple of days back I was trying to check confiugrations apache was built with. You can use "httpd -l" to check the list of compiled in modules.