shell 脚本的探测web

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

posted @ 2023-08-24 18:08  等待1248  阅读(19)  评论(0)    收藏  举报