This commit is contained in:
netkiller
2016-12-09 15:05:44 +08:00
parent 50a9e30987
commit 9dae2851ee

View File

@@ -15,7 +15,7 @@ if [ -f ${CACHE} ]; then
fi
if [ ! -f ${CACHE} ]; then
ss -ant | awk '{++stats[$1]} END {for(a in stats) print a, stats[a]}' > ${CACHE}
ss -ant | awk 'BEGIN {stats["CLOSE-WAIT"]=0;stats["ESTAB"]=0;stats["FIN-WAIT-1"]=0;stats["FIN-WAIT-2"]=0;stats["LAST-ACK"]=0;stats["SYN-RECV"]=0;stats["SYN-SENT"]=0;stats["TIME-WAIT"]=0} {++stats[$1]} END {for(a in stats) print a, stats[a]}' > ${CACHE}
fi
grep $1 ${CACHE} | cut -d " " -f2