From 796c2bf1e149c0a587ef9170ce4a5245ff47ec7a Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 6 Dec 2022 23:23:30 +0100 Subject: [PATCH] CLEAN START DEAMON MODE --- G1BILLETS.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/G1BILLETS.sh b/G1BILLETS.sh index 0b9a0be..fa7621a 100755 --- a/G1BILLETS.sh +++ b/G1BILLETS.sh @@ -102,15 +102,16 @@ echo "$ZFILE" else ################################################################################ ## MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102 -############## DEAMON MODE ### +############## CLEAN START DEAMON MODE ### + pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33101" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 2) + [[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING 33101 $pidportinuse" + pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33102" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 2) + [[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING NOT COLLECTED THREAD $pidportinuse" ##################################################################### myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ $isLAN ]] && HNAME="http://g1billet.localhost" || HNAME="http://$(hostname)" - pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p 33102" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 2) - [[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING NOT COLLECTED THREAD $pidportinuse" - HTTPWELLCOME='HTTP/1.1 200 OK Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true