From 6bb241d33a1be642c181414c6baa51fb390759c8 Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 6 Aug 2021 12:24:24 +0200 Subject: [PATCH] ipfs ping loop on FRIENDS --- zen/tools/ping_my_friends_on_ipfs.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/zen/tools/ping_my_friends_on_ipfs.sh b/zen/tools/ping_my_friends_on_ipfs.sh index 0bcf19d..0fb7faa 100755 --- a/zen/tools/ping_my_friends_on_ipfs.sh +++ b/zen/tools/ping_my_friends_on_ipfs.sh @@ -1,11 +1,20 @@ #!/bin/bash -################################################################################ -echo "## IPFS PINGing MY FRIENDS" -for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do - if [[ $g1pub ]]; then - friendipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) - ipfs ping --timeout=7s -n 3 /ipfs/$friendipfsnodeid 2>/dev/null; - [[ $? == 0 ]] && ipfs cat /ipns/$friendipfsnodeid/.$friendipfsnodeid/_xbian.zuid && ipfs cat /ipns/$friendipfsnodeid/.$friendipfsnodeid/G1SSB/_g1.gchange_title - echo "###########################################" +######################################################################## +MY_PATH="`dirname \"$0\"`" # relative +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 + +echo "## IPFS PINGing MY FRIENDS" + +for ipfsid in $(cat ~/.zen/ipfs_swarm/.*/.ipfsnodeid); do + if [[ $ipfsid != $IPFSNODEID ]]; then + echo "TESTING $ipfsid" + ipfs -timeout=7s ping -n5 /p2p/$ipfsid | tail -n 1 + (echo "Station $(ipfs -timeout=10s cat /ipns/$ipfsid/.$ipfsid/_xbian.zuid) [$(cat ~/.zen/ipfs_swarm/.$ipfsid/_xbian.zuid)] : OK" + else + echo "Station $(cat ~/.zen/ipfs_swarm/.$ipfsid/_xbian.zuid) : DEAD") fi + echo "" done