Your syntax is wrong. You need elif
instead of else
. Also you're mssing fi
at the end of your if
statement. Also, for what it's worth, you should wrap $TEMPFILE
in double quotes to prevent word splitting for files that contains spaces.
if [[ "$Webserver" == "Apache" ]]; then
echo "Webserver Apache Uptime: $(/etc/init.d/httpd status | grep "Server uptime")" >> "$TEMPFILE"
elif [ "$Webserver" == "LiteSpeed" ]; then
echo "Webserver Litespeed: $(head -n4 /tmp/lshttpd/.rtreport | grep UPTIME)" >> "$TEMPFILE"
echo "Unidentified Webserver"
fi
If you need some good references these are two of my favorite: