From f530cf8cdd4f312e02aca45e024dd347b94c86a2 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 14 Apr 2024 17:37:53 +0200 Subject: [PATCH] | xargs --- 12345.sh | 6 +++--- API/QRCODE.sh | 8 ++++---- API/UPLANET.sh | 2 +- ASTROBOT/_sandbox/_G1CrowdBunker.sh | 6 +++--- RUNTIME/DRAGON_p2p_ssh.sh | 6 ++++++ RUNTIME/G1Voeu.sh | 2 +- RUNTIME/NODE.refresh.sh | 4 ++-- RUNTIME/PLAYER.refresh.sh | 1 + RUNTIME/UPLANET.refresh.sh | 2 ++ _12345.sh | 10 +++++----- adventure/games/damien.espenel@ynov.com/README | 2 +- .../games/damien.espenel@ynov.com/rooms/riddle.sh | 2 +- ajouter_media.sh | 6 +++--- tools/Connect_PLAYER_To_Gchange.sh | 4 ++-- tools/ipfs_setup.sh | 2 +- tools/my.sh | 6 +++--- tools/qrscan_login.sh | 2 +- 17 files changed, 40 insertions(+), 31 deletions(-) diff --git a/12345.sh b/12345.sh index 51c6dfc0..ca54c084 100755 --- a/12345.sh +++ b/12345.sh @@ -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 & diff --git a/API/QRCODE.sh b/API/QRCODE.sh index b1c7a27b..68764e6c 100755 --- a/API/QRCODE.sh +++ b/API/QRCODE.sh @@ -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 diff --git a/API/UPLANET.sh b/API/UPLANET.sh index 25ecad6f..262d873c 100755 --- a/API/UPLANET.sh +++ b/API/UPLANET.sh @@ -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 diff --git a/ASTROBOT/_sandbox/_G1CrowdBunker.sh b/ASTROBOT/_sandbox/_G1CrowdBunker.sh index 795e9ef1..b11ac531 100755 --- a/ASTROBOT/_sandbox/_G1CrowdBunker.sh +++ b/ASTROBOT/_sandbox/_G1CrowdBunker.sh @@ -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" diff --git a/RUNTIME/DRAGON_p2p_ssh.sh b/RUNTIME/DRAGON_p2p_ssh.sh index e4bbbe1c..ffb18473 100755 --- a/RUNTIME/DRAGON_p2p_ssh.sh +++ b/RUNTIME/DRAGON_p2p_ssh.sh @@ -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 diff --git a/RUNTIME/G1Voeu.sh b/RUNTIME/G1Voeu.sh index 0d0838c7..16d08b5f 100755 --- a/RUNTIME/G1Voeu.sh +++ b/RUNTIME/G1Voeu.sh @@ -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}" diff --git a/RUNTIME/NODE.refresh.sh b/RUNTIME/NODE.refresh.sh index 63381e28..570a32d3 100755 --- a/RUNTIME/NODE.refresh.sh +++ b/RUNTIME/NODE.refresh.sh @@ -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}" diff --git a/RUNTIME/PLAYER.refresh.sh b/RUNTIME/PLAYER.refresh.sh index eec16da5..5d81fd54 100755 --- a/RUNTIME/PLAYER.refresh.sh +++ b/RUNTIME/PLAYER.refresh.sh @@ -644,4 +644,5 @@ fi done echo "============================================ PLAYER.refresh DONE." + exit 0 diff --git a/RUNTIME/UPLANET.refresh.sh b/RUNTIME/UPLANET.refresh.sh index ebcd1c54..d377a480 100755 --- a/RUNTIME/UPLANET.refresh.sh +++ b/RUNTIME/UPLANET.refresh.sh @@ -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 ###################################################### diff --git a/_12345.sh b/_12345.sh index 1d3db7f0..ac8a6189 100755 --- a/_12345.sh +++ b/_12345.sh @@ -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 diff --git a/adventure/games/damien.espenel@ynov.com/README b/adventure/games/damien.espenel@ynov.com/README index d0eb00ab..809ff6f0 100644 --- a/adventure/games/damien.espenel@ynov.com/README +++ b/adventure/games/damien.espenel@ynov.com/README @@ -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 ``` diff --git a/adventure/games/damien.espenel@ynov.com/rooms/riddle.sh b/adventure/games/damien.espenel@ynov.com/rooms/riddle.sh index 18c2d645..446d46c1 100755 --- a/adventure/games/damien.espenel@ynov.com/rooms/riddle.sh +++ b/adventure/games/damien.espenel@ynov.com/rooms/riddle.sh @@ -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 diff --git a/ajouter_media.sh b/ajouter_media.sh index ab6515e9..330cc3fe 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -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)" \ diff --git a/tools/Connect_PLAYER_To_Gchange.sh b/tools/Connect_PLAYER_To_Gchange.sh index 5a596799..37f75791 100755 --- a/tools/Connect_PLAYER_To_Gchange.sh +++ b/tools/Connect_PLAYER_To_Gchange.sh @@ -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 & diff --git a/tools/ipfs_setup.sh b/tools/ipfs_setup.sh index 4b427f3f..63d656df 100755 --- a/tools/ipfs_setup.sh +++ b/tools/ipfs_setup.sh @@ -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` diff --git a/tools/my.sh b/tools/my.sh index b5bd04bf..737f35be 100755 --- a/tools/my.sh +++ b/tools/my.sh @@ -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" } diff --git a/tools/qrscan_login.sh b/tools/qrscan_login.sh index 7251afb2..abf1179a 100755 --- a/tools/qrscan_login.sh +++ b/tools/qrscan_login.sh @@ -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"