常用shell脚本集
1、监测来自某个IP的TCP活动连接数
#!/bin/sh while true do time=$(date '+%Y-%m-%d %H:%M:%S') tcp=$(netstat -ano|grep 9100 |grep 192.168.0.236 |wc -l) out="$time tcp connect counter=$tcp" echo $out >> t.log sleep 5 done
常用shell脚本集
1、监测来自某个IP的TCP活动连接数
#!/bin/sh while true do time=$(date '+%Y-%m-%d %H:%M:%S') tcp=$(netstat -ano|grep 9100 |grep 192.168.0.236 |wc -l) out="$time tcp connect counter=$tcp" echo $out >> t.log sleep 5 done