diff --git a/zen/gchange_INIT.sh b/zen/gchange_INIT.sh index 3c6a7b1..28723a1 100755 --- a/zen/gchange_INIT.sh +++ b/zen/gchange_INIT.sh @@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 +start=`date +%s` # Retrieve Gchange profil data # Sends "ipfstryme" messages to liked linking_me NODES @@ -267,5 +268,8 @@ done # https://forum.monnaie-libre.fr/t/etude-commencer-a-la-moyenne/15231/34?u=qoop # https://forum.monnaie-libre.fr/t/formules-en-referentiel-du-et-m-n/10417 - +echo "#### EXCECUTION TIME" +end=`date +%s` +echo Execution time was `expr $end - $start` seconds. +echo "########################################################################" exit 0 diff --git a/zen/gchange_IPFS_swarm.sh b/zen/gchange_IPFS_swarm.sh index 2202dcf..f9cf1f6 100755 --- a/zen/gchange_IPFS_swarm.sh +++ b/zen/gchange_IPFS_swarm.sh @@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 +start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 @@ -59,7 +60,7 @@ do ipfs --timeout=30s cat /ipns/$ipfsnodeid/.$ipfsnodeid/tryme.addr > /tmp/ipfstryme.$liking_me if [[ ! -f /tmp/ipfstryme.$liking_me ]]; then - echo ": READING 'ipfstryme' message from $liking_me" + echo "TIMEOUT : READING 'ipfstryme' message from $liking_me" ## GCHANGE ACCESS ## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message ~/.zen/astrXbian/zen/tools/timeout.sh -t 12 ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me fi @@ -72,8 +73,11 @@ do for line in $(cat /tmp/ipfstryme.$liking_me | shuf); do ipfsnodeid=$(echo $line | rev | cut -d '/' -f 1 | rev) + stationip=$(echo $line | cut -d '/' -f 3) + ping -c 1 -W 1 $stationip 2>&1>/dev/null && sping="OK" || sping="NOK" + echo "## $sping PING $stationip STATION $ipfsnodeid" [[ $ipfsnodeid == "" ]] && break - [[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && echo $line >> /tmp/ipfstryme.clean + [[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && [[ "$sping" == "OK" ]] && echo $line >> /tmp/ipfstryme.clean done cat /tmp/ipfstryme.clean | sort | uniq > /tmp/ipfstryme.$liking_me @@ -105,7 +109,7 @@ do [[ $nbmessage == 0 ]] && echo "NO ipfstryme MESSAGE from $whoisg1" && echo "$ipfsnodeid" >> ~/.zen/A_dead_swarm.txt && continue # SEND MESSAGE ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" send -d $whoisg1 -t 'Astroport' -m 'Aucun message de ta part https://copylaradio.com'" - ## CHECKING VALUE CAPSULE + ## CHECKING STARS FROM IPNS starsin=$(ipfs --timeout=10s cat /ipns/$ipfsnodeid/.$ipfsnodeid/FRIENDS/$G1PUB/stars.level) starsout=$(ipfs --timeout=10s cat /ipns/$IPFSNODEID/.$IPFSNODEID/FRIENDS/$whoisg1/stars.level) @@ -134,7 +138,7 @@ do echo "ALREADY RECORDED FRIEND" fi ## Sync ipfs_swarm - ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid + ipfs --timeout=120s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid else ## REMOVE FRIENDS DIRECTORY (should be removed from Astroport App) echo "NOT FULL FRIEND $ipfsnodeid / $whoisg1" @@ -145,10 +149,10 @@ do done; # UNIQ file -cat ~/.zen/A_my_swarm.txt | sort | uniq > /tmp/A_my_swarm.txt +cat ~/.zen/A_my_swarm.txt | rev | sort | uniq | rev > /tmp/A_my_swarm.txt cp -f /tmp/A_my_swarm.txt ~/.zen/A_my_swarm.txt -cat ~/.zen/A_Qm_swarm.txt | sort | uniq > /tmp/A_Qm_swarm.txt +cat ~/.zen/A_Qm_swarm.txt | rev | sort | uniq | rev > /tmp/A_Qm_swarm.txt cp -f /tmp/A_Qm_swarm.txt ~/.zen/A_Qm_swarm.txt echo "#################################################### @@ -195,3 +199,8 @@ done cat ~/.zen/A_my_swarm.txt | sort | uniq > /tmp/A_my_swarm.txt cp -f /tmp/A_my_swarm.txt ~/.zen/A_my_swarm.txt cp -f ~/.zen/A_my_swarm.txt ~/.zen/A_swarm_map.txt + +echo "#### EXCECUTION TIME" +end=`date +%s` +echo Execution time was `expr $end - $start` seconds. +echo "########################################################################" diff --git a/zen/ipfs_FRIENDS_refresh.sh b/zen/ipfs_FRIENDS_refresh.sh index 2a96ec5..dfd29f7 100755 --- a/zen/ipfs_FRIENDS_refresh.sh +++ b/zen/ipfs_FRIENDS_refresh.sh @@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 +start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 @@ -50,6 +51,9 @@ do ls -d ~/.zen/ipfs_swarm/.$ipfsnodeid/FRIENDS/$G1PUB/ 2>/dev/null | rev | cut -d '/' -f 2 | rev done - +echo "#### EXCECUTION TIME" +end=`date +%s` +echo Execution time was `expr $end - $start` seconds. +echo "########################################################################" exit 0 diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index 13ae81a..edc3225 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l) [[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0 +start=`date +%s` YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1 G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1 @@ -347,5 +348,8 @@ echo "" >> ~/.zen/ipfs/.${IPFSNODEID}/FRIENDS/index.html ######################################################################## ~/.zen/astrXbian/zen/ipns_self_publish.sh ######################################################################## - +echo "#### EXCECUTION TIME" +end=`date +%s` +echo Execution time was `expr $end - $start` seconds. +echo "########################################################################" exit 0