From f25f02ae55e355a496feb6c7e3174fb6d8d9a854 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 16 Nov 2022 07:11:44 +0100 Subject: [PATCH] kill old portinuse --- 12345.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/12345.sh b/12345.sh index 379d29b9..35502650 100755 --- a/12345.sh +++ b/12345.sh @@ -62,8 +62,8 @@ while true; do MOATS=$(date -u +"%Y%m%d%H%M%S%4N") ## CHANGE NEXT PORT (HERE YOU CREATE A SOCKET QUEUE) [ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2})) - portinuse=$(ps auxf --sort=+utime | grep -w ${PORT} | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) - [[ $portinuse ]] && echo "$portinuse" && continue + pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 2) + [[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING $portinuse " && continue ## RANDOM PORT SWAPPINESS AVOIDING COLLISION ## CHECK 12345 PORT RUNNING (PUBLISHING IPNS SWARM MAP)