|
发表于 2016-1-4 16:26:41
|
显示全部楼层
来自 中国–上海–上海
本帖最后由 hackroad 于 2016-1-4 16:48 编辑
linux不需要额外的监控器,脚本就行了。
如果有炸服碰到端口存活,但是实际上没有响应的自己加个NC探测。
[mw_shl_code=c,true]#!/bin/sh
UDP_PORT=`netstat -an | grep "$1 " | awk '$1 == "udp" && $NF == "0.0.0.0:*" {print $0}' |grep ":27015 " | wc -l`
# hlds_27015为Screen中对应的sockname
UDP_PORT_PID=`ps -ef|grep hlds_27015|grep -v grep|awk '{print $2}'`
echo `date '+%Y-%m-%d %H:%M:%S'`
if [ $UDP_PORT == 0 ]
then
{
echo "-----------------------------"
echo "27015 is not listening"
kill -9 $UDP_PORT_PID
screen -wipe
cd /home/hlds_15_default/
./start_27015.sh
echo `netstat -an | grep "$1 " | awk '$1 == "udp" && $NF == "0.0.0.0:*" {print $0}' |grep ":27015 "`
echo "-----------------------------"
}
else
{
echo "-----------------------------"
echo "27015 is listening"
echo `netstat -an | grep "$1 " | awk '$1 == "udp" && $NF == "0.0.0.0:*" {print $0}' |grep ":27015 "`
echo "-----------------------------"
}
echo "Check CS Port Complete !"
echo ""
echo ""
echo ""[/mw_shl_code] |
|