I am trying to write a script to automate my server auditing headaches. I need to check what webserver is running on a server and then find its uptime. But eventhough I am able to find out the webserver I can't compare it with the variable I have saved it to..Here is the part I am having issue with. This is in bash.
Webserver=`curl -Is $(hostname -i) | grep "Server" | awk {'print $2'} | cut -d'/' -f1`
if [ "$Webserver" == "Apache" ]
then
echo "Webserver Apache Uptime: $(/etc/init.d/httpd status | grep "Server uptime")" >> $TEMPFILE
else if [ "$Webserver" == "LiteSpeed" ]
then
echo "Webserver Litespeed: $(head -n4 /tmp/lshttpd/.rtreport | grep UPTIME)" >> $TEMPFILE
else
echo "Unidentified Webserver"
NB: I have the results saved to a temp file in /tmp