标签:bash httpd star color grep port 服务器 ash netstat
写一个脚本判断你的 Linux 服务器里是否开启 web 服务,如果开启了,请判断出跑的是什么服务,是 httpd 呢还是 nginx 又或者是其他的什么服务
#!/bin/bash port=`netstat -lnp | grep 80` if [ -z "port" ]; then echo "no start services." exit fi web_service=`echo $port | awk -F ‘/‘ ‘{print $2}‘` case $web_service in httpd) echo "httpd service" ;; nginx) echo "nginx service" ;; *) echo "other service" esac
标签:bash httpd star color grep port 服务器 ash netstat
原文地址:http://www.cnblogs.com/pzk7788/p/7428938.html