web 服务的探测。
#!/bin/bash
port=`netstat -lnp | grep 80`
if [ -z "port" ]; then
echo "not start service.";
exit;
fi
web_server=`echo $port | awk -F'/' '{print $2}'|awk -F : '{print $1}'`
case $web_server in
httpd )
echo "apache server."
;;
nginx )
echo "nginx server."
;;
* )
echo "other server."
;;
esac