From 1f6170ace5dc6d4d91adcf4fb04fedfc42fca232 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 12 Dec 2022 18:41:39 +0100 Subject: [PATCH] start and command --- 12345.sh | 4 ++-- 20h12.process.sh | 4 +++- start.sh | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/12345.sh b/12345.sh index a0a1bd41..7439f59e 100755 --- a/12345.sh +++ b/12345.sh @@ -19,7 +19,7 @@ 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 ]] && myHOST="ipfs.localhost" && myHOSTPort="ipfs.localhost:8080" && myHTTP="http://" && myASTROPORT="http://astroport.localhost:1234" ## LAN STATION -[[ ! $isLAN || $USER="zen" ]] && myHOST="astroport.copylaradio.com" && myHOSTPort="ipfs.copylaradio.com" && myHTTP="https://" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION +[[ ! $isLAN || $USER == "zen" ]] && myHOST="astroport.copylaradio.com" && myHOSTPort="ipfs.copylaradio.com" && myHTTP="https://" && myASTROPORT="https://astroport.copylaradio.com" ## WAN STATION PORT=12345 @@ -31,7 +31,7 @@ mkdir -p ~/.zen/tmp/coucou/ ## CHECK FOR ANY ALREADY RUNNING nc ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) -[[ $ncrunning ]] && echo "ERROR - API Server Already Running - ${myHTTP}${myHOST}:1234/?salt=totodu56&pepper=totodu56&getipns " && exit 1 +[[ $ncrunning ]] && echo "ERROR - API Server Already Running - ${myASTROPORT}/?salt=totodu56&pepper=totodu56&getipns " && exit 1 ## NOT RUNNING TWICE # Some client needs to respect that diff --git a/20h12.process.sh b/20h12.process.sh index c31ca19b..03ac34eb 100755 --- a/20h12.process.sh +++ b/20h12.process.sh @@ -37,6 +37,8 @@ git pull killall 12345.sh killall _12345.sh killall nc +killall command.sh +killall start.sh espeak "Players refresh" > /dev/null 2>&1 # Refresh ~/.zen/game/players/PLAYER @@ -44,7 +46,7 @@ espeak "Players refresh" > /dev/null 2>&1 espeak "Restarting API" > /dev/null 2>&1 ## OPEN API ENGINE -~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log & +~/.zen/Astroport.ONE/start.sh > ~/.zen/tmp/12345.log & if [[ ! $isLAN ]]; then ## REFRESH BOOTSTRAP LIST (OFFICIAL SWARM) diff --git a/start.sh b/start.sh index a974de3d..3604f73f 100755 --- a/start.sh +++ b/start.sh @@ -20,15 +20,19 @@ ${MY_PATH}/tools/cron_VRFY.sh ON echo "(RE)STARTING 12345.sh" ################################################### -killall 12345.sh; killall "_12345.sh"; killall nc +[[ ~/.zen/.pid ]] && killall "command.sh"; kill -9 $(cat ~/.zen/.pid) +# killall "12345.sh"; killall "_12345.sh"; killall "nc"; mkdir -p ~/.zen/tmp + exec ~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log & PID=$! +echo $PID > ~/.zen/.pid -sleep 1 echo "HTTP API : http://$myIP:1234" +sleep 2 cat ~/.zen/tmp/12345.log echo "API DEBUG : tail -f ~/.zen/tmp/12345.log" ################################################### ${MY_PATH}/command.sh +