#!/bin/bash

lsof -i :80  &> /dev/null

LS=`echo $?`

elinkshttp://192.168.5.14 -dump &> /dev/null

CA=`echo $?`

T=`curl -s -o/dev/null -w %{time_total}"\n" "http://192.168.5.14" | cut-d "." -f1`

if [ $LS -ne 0];then

        echo "unknow apache";exit 3

elif [ $CA -ne 0];then

        echo "warning:there is somethingwrong with apache";exit 2

elif [ $T -ge 5];then

        echo "warning:Response time is $Ts";exit 2

else

        echo "Response time isok";exit 0

fi