This commit is contained in:
fred 2024-04-14 17:37:53 +02:00
parent a9a7f23a3b
commit f530cf8cdd
17 changed files with 40 additions and 31 deletions

View File

@ -25,7 +25,7 @@ PORT=45779
mkdir -p ~/.zen/tmp ~/.zen/game/players/localhost # ~/.zen & myos compatibility
## CHECK FOR ANY ALREADY RUNNING nc
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $ncrunning ]] && echo "RESTARTING" && kill -9 $ncrunning
## NOT RUNNING TWICE
@ -71,12 +71,12 @@ while true; do
## CHECK PORT IS FREE & KILL OLD ONE
echo "SEARCHING FOR PORT ${PORT}"
ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep'
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $pidportinuse ]] && kill -9 $pidportinuse && echo "$(date) KILLING LOST $pidportinuse"
### START MAP STATION 12345
## CHECK 12345 PORT RUNNING (STATION FoF MAP)
maprunning=$(ps auxf --sort=+utime | grep -w '_12345.sh' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
maprunning=$(ps auxf --sort=+utime | grep -w '_12345.sh' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ ! $maprunning ]] \
&& echo '(ᵔ◡◡ᵔ) MAP LAUNCHING http://'${myIP}':12345 (ᵔ◡◡ᵔ)' \
&& exec $MY_PATH/_12345.sh &

View File

@ -88,7 +88,7 @@ fi
if [[ ${QRCODE} == "station" ]]; then
## CHECK FOR ANY ALREADY RUNNING make_image_ipfs_index_carousel
carouselrunning=$(ps axf --sort=+utime | grep -w 'make_image_ipfs_index_carousel' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
carouselrunning=$(ps axf --sort=+utime | grep -w 'make_image_ipfs_index_carousel' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
if [[ ! -s ~/.zen/tmp/ISTATION ]]; then
if [[ $carouselrunning ]]; then
@ -166,7 +166,7 @@ if [[ ${QRCODE:0:5} == "~~~~~" ]]; then
echo "COINScheck.sh ${G1PUB}"
${MY_PATH}/../tools/COINScheck.sh ${G1PUB} > ~/.zen/tmp/${G1PUB}.curcoin
CURCOINS=$(cat ~/.zen/tmp/${G1PUB}.curcoin | tail -n 1 | cut -d '.' -f 1)
CURCOINS=$(cat ~/.zen/tmp/${G1PUB}.curcoin | tail -n 1 | xargs | cut -d '.' -f 1)
CURZEN=$(echo "($CURCOINS - 1) * 10" | bc | cut -d '.' -f 1)
echo "= $CURCOINS G1 / $CURZEN ZEN"
@ -485,7 +485,7 @@ if [[ ${QRCODE:0:5} == "@@@@@" ]]; then
if [[ ! -s ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt ]]; then
HELLO="@PASS :: G1BILLET+ :: ${G1VOEUPUB} :: $(date) :: ${player} :: ${PLAYERORIG1}"
echo "${HELLO}"
avanla=$(ps axf --sort=+utime | grep -w 'ipfs cat /ipns/$G1VOEUNS' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
avanla=$(ps axf --sort=+utime | grep -w 'ipfs cat /ipns/$G1VOEUNS' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ ! $avanla ]] \
&& ( ipfs cat /ipns/$G1VOEUNS > ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt \
&& [[ ! -s ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt ]] \
@ -583,7 +583,7 @@ if [[ ${QRCODE:0:2} == "G1" && ${AND} == "tw" ]]; then
VOEU=${QRCODE:2} ## "G1G1Voeu" => "G1Voeu"
# THIS is TW IPNS
ASTROPATH=$(grep -r ${THIS} ~/.zen/game/players/*/ipfs/moa | tail -n 1 | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
ASTROPATH=$(grep -r ${THIS} ~/.zen/game/players/*/ipfs/moa | tail -n 1 | xargs | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
echo "ASTROPATH=${ASTROPATH}"
INDEX=${ASTROPATH}/index.html

View File

@ -39,7 +39,7 @@ Content-Type: text/html; charset=UTF-8
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
## CHECK FOR NOT PUBLISHING ALREADY (AVOID IPNS CRUSH)
alreadypublishing=$(ps axf --sort=+utime | grep -w 'ipfs name publish --key=' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
alreadypublishing=$(ps axf --sort=+utime | grep -w 'ipfs name publish --key=' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
if [[ ${alreadypublishing} ]]; then
echo "$HTTPCORS ERROR - (╥☁╥ ) - IPFS ALREADY PUBLISHING RETRY LATER" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
exit 1

View File

@ -54,9 +54,9 @@ for VUID in $(cat ~/.zen/bunkerbox/crowd.json | jq -r '.posts | .[] | .video.id'
echo ">>>>>>>>>>>>>>>> Downloading VIDEO"
# Choose 360p or 480p or 240p
VSIZE=360 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
[[ "$VIDEOSRC" == "" ]] && VSIZE=480 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
[[ "$VIDEOSRC" == "" ]] && VSIZE=240 &&VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
VSIZE=360 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
[[ "$VIDEOSRC" == "" ]] && VSIZE=480 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
[[ "$VIDEOSRC" == "" ]] && VSIZE=240 &&VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
VTHUMB="$(cat ~/.zen/bunkerbox/$VUID/$VUID.json | jq -r --arg VSIZE "$VSIZE" '.video.thumbnails[] | select(.height == $VSIZE) | .url')"
echo ">>>>>>>>>>>>>>>> Downloading Video $VSIZE Thumbnail"

View File

@ -125,4 +125,10 @@ if [[ -s ~/.zen/prometheus/prometheus ]]; then
fi
ncrunning=$(ps axf --sort=+utime | grep -w 'node_exporter' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $ncrunning ]] && echo "RESTARTING" && kill -HUP $ncrunning
/usr/local/bin/node_exporter &
exit 0

View File

@ -92,7 +92,7 @@ echo ${WISHG1PUB} > ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/.wish
echo "# CREATION QR CODE"
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2)
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.WISHLINK.png" "$LIBRA/ipns/${VOEUNS}"

View File

@ -25,7 +25,7 @@ echo "## RUNNING NODE.refresh"
if [[ -d ~/.zen/tmp/${IPFSNODEID} ]]; then
# ONLY FRESH DATA HERE
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
## Getting actual online version
#~ ipfs get -o ~/.zen/tmp/${IPFSNODEID} /ipns/${IPFSNODEID}/
@ -66,7 +66,7 @@ if [[ -d ~/.zen/tmp/${IPFSNODEID} ]]; then
echo "############################################ MY MAP "
ls ~/.zen/tmp/${IPFSNODEID}/
echo "############################################"
NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
ROUTING=$(ipfs add -rwHq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 )
ipfs name publish /ipfs/${ROUTING}
echo ">> $NSIZE Bytes STATION BALISE > ${myIPFS}/ipns/${IPFSNODEID}"

View File

@ -644,4 +644,5 @@ fi
done
echo "============================================ PLAYER.refresh DONE."
exit 0

View File

@ -540,6 +540,7 @@ for UMAP in ${unique_combined[@]}; do
done
######################################################
### LEVEL 2 ###########################################
######################################################
@ -553,6 +554,7 @@ ${MY_PATH}/SECTOR.refresh.sh "${unique_combined[@]}"
${MY_PATH}/REGION.refresh.sh "${unique_combined[@]}"
######################################################
######################################################
exit 0
######################################################

View File

@ -18,10 +18,10 @@ exec 2>&1 >> ~/.zen/tmp/_12345.log
PORT=12345
YOU=$(myIpfsApi); ## API of $USER running ipfs
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL
## KILLING OLD DAEMON OF MYSELF
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 12345' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 2)
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 12345' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $ncrunning != "" ]] && echo "(≖‿‿≖) - KILLING Already Running MAP Server - (≖‿‿≖) " && kill -9 $ncrunning
## WHAT IS NODEG1PUB
@ -224,7 +224,7 @@ while true; do
while read branch; do [[ $branch =~ "4096" ]] && echo "empty $branch" && rm -Rf $(echo $branch | cut -f 2 -d ' '); done < /tmp/du
############### UPDATE MySwarm CHAN
ls ~/.zen/tmp/swarm
SWARMSIZE=$(du -b ~/.zen/tmp/swarm | tail -n 1 | cut -f 1)
SWARMSIZE=$(du -b ~/.zen/tmp/swarm | tail -n 1 | xargs | cut -f 1)
## SIZE MODIFIED => PUBLISH MySwarm_${IPFSNODEID}
[[ ${SWARMSIZE} != $(cat ~/.zen/tmp/swarm/.bsize 2>/dev/null) ]] \
@ -243,13 +243,13 @@ while true; do
# Scan IPFSNODEID cache
ls ~/.zen/tmp/${IPFSNODEID}/
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
## IPFS GET LAST ONLINE IPFSNODEID MAP
rm -Rf ~/.zen/tmp/_${IPFSNODEID} 2>/dev/null
mkdir -p ~/.zen/tmp/_${IPFSNODEID}
ipfs get --progress="false" -o ~/.zen/tmp/_${IPFSNODEID}/ /ipns/${IPFSNODEID}/
NSIZE=$(du -b ~/.zen/tmp/_${IPFSNODEID} | tail -n 1 | cut -f 1)
NSIZE=$(du -b ~/.zen/tmp/_${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
### CHECK IF SIZE DIFFERENCE ?
## Local / IPNS size differ => FUSION LOCAL OVER ONLINE & PUBLISH

View File

@ -54,7 +54,7 @@ mv mastergusser.sh rooms/riddle.sh
```
```
mplayerrunning=$(ps axf --sort=+utime | grep -w 'mplayer' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
mplayerrunning=$(ps axf --sort=+utime | grep -w 'mplayer' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $mplayerrunning ]] && kill $mplayerrunning
```

View File

@ -22,7 +22,7 @@ devine_le_nombre() {
echo "Fin de la session..."
# kill $!
## CHECK FOR ANY ALREADY RUNNING mplayer
mplayerrunning=$(ps axf --sort=+utime | grep -w 'mplayer' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
mplayerrunning=$(ps axf --sort=+utime | grep -w 'mplayer' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $mplayerrunning ]] && kill $mplayerrunning
exit 0
elif [ $guess -lt $nombre_secret ]; then

View File

@ -176,8 +176,8 @@ fi
###
# IS THERE ANY RUNNING IPFS ADD OR PUBLISH IN PROGRESS ?
ISADDING=$(ps auxf --sort=+utime | grep -w 'ipfs add' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
ISPUBLISHING=$(ps auxf --sort=+utime | grep -w 'ipfs name publish' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
ISADDING=$(ps auxf --sort=+utime | grep -w 'ipfs add' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
ISPUBLISHING=$(ps auxf --sort=+utime | grep -w 'ipfs name publish' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $ISADDING || $ISPUBLISHING ]] \
&& espeak "I P F S task in progress. Wait finish & try later" && exit 1
@ -847,7 +847,7 @@ if [[ -s ~/Astroport/${PLAYER}/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json ]]; t
########################################################################
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
## GETTING LAST TW via IPFS or HTTP GW
LIBRA=$(head -n 2 ${MY_PATH}/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
LIBRA=$(head -n 2 ${MY_PATH}/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2)
rm -f ~/.zen/tmp/astronaut_TW.html > /dev/null 2>&1
[[ $YOU ]] \
&& echo " ipfs --timeout 120s cat --progress=false /ipns/${ASTRONAUTENS} ($YOU)" \

View File

@ -245,8 +245,8 @@ do
## GET FRIEND TW !!
echo "SEARCHING $FRIENDTITLE - ONLINE TW -"
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1);
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2)
# DISPLAY TIMER
# ${MY_PATH}/displaytimer.sh 60 &

View File

@ -24,7 +24,7 @@ err() {
# CHECK node IP isLAN?
myIP=$(hostname -I | awk '{print $1}')
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1);
MACHINE_TYPE=`uname -m`

View File

@ -170,7 +170,7 @@ myIpfsBootstrapNodes() {
myIpfsGw() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myIpfsGw=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | cut -d ' ' -f 2)
&& local myIpfsGw=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | xargs | cut -d ' ' -f 2)
[ -n "$myIpfsGw" ] && echo "$myIpfsGw"
}
@ -407,13 +407,13 @@ myTs() {
myTube() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myTube=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | cut -d ' ' -f 3)
&& local myTube=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | xargs | cut -d ' ' -f 3)
[ -n "$myTube" ] && echo "$myTube"
}
myAstroTube() {
[ -f "$(myAstroPath)/A_boostrap_nodes.txt" ] \
&& local myAstroTube=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | cut -d ' ' -f 3 | sed "s~ipfs~astroport~g")
&& local myAstroTube=$(head -n2 "$(myAstroPath)/A_boostrap_nodes.txt" | tail -n 1 | xargs | cut -d ' ' -f 3 | sed "s~ipfs~astroport~g")
[ -n "$myAstroTube" ] && echo "$myAstroTube"
}

View File

@ -7,7 +7,7 @@ ME="${0##*/}"
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
qrscan=$(ps auxf --sort=+utime | grep -w qrscan_login.sh | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
qrscan=$(ps auxf --sort=+utime | grep -w qrscan_login.sh | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
[[ $qrscan ]] && echo "qrscan already running" && exit 1
# Check if Astroport Station already has a "captain"