start and command

This commit is contained in:
fred 2022-12-12 18:41:39 +01:00
parent c8820de8cc
commit 1f6170ace5
3 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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