lnp pan linux 服务器 ces 开启 class 服务 httpd
写一个脚本判断你的 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
判断是否开启 Web 服务
来源: http://www.bubuko.com/infodetail-2278287.html