#!/bin/bash ######################################################################## 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 2>/dev/null | tail -n 1 if [ $? -eq 0 ]; then zuidonline=$(ipfs -timeout=10s cat /ipns/$ipfsid/.$ipfsid/.player 2>/dev/null) || zuidonline="TIMEOUT" [[ -f ~/.zen/ipfs_swarm/.$ipfsid/.player ]] && zuidoffline=$(cat ~/.zen/ipfs_swarm/.$ipfsid/.player) || zuidoffline="UNKOWN" echo "Station $zuidonline [$zuidoffline] : OK" else echo "Station $(cat ~/.zen/ipfs_swarm/.$ipfsid/.player) : DEAD" fi echo "" fi done