diff --git a/tcpstats/tcpstats b/tcpstats/tcpstats index 40f040f..c88bcc6 100644 --- a/tcpstats/tcpstats +++ b/tcpstats/tcpstats @@ -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 \ No newline at end of file