forked from axiom-team/astrXbian
DEFCON3 takes too much time with fail2ban. DEFCON5. ping & FRIENDS swarm sync more regularly
This commit is contained in:
parent
25b414c69c
commit
ebd47017c3
|
@ -11,6 +11,8 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
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
|
||||||
|
|
||||||
source $HOME/.profile
|
source $HOME/.profile
|
||||||
# CORRECT PATH
|
# CORRECT PATH
|
||||||
|
@ -92,6 +94,10 @@ fi
|
||||||
# RUN TIME $runtime
|
# RUN TIME $runtime
|
||||||
|
|
||||||
echo "RUNTIME $runtime mn ($timebar)"
|
echo "RUNTIME $runtime mn ($timebar)"
|
||||||
|
## PING ALL MY FRIENDS TO ENHANCE SWARM CONNECTIVITY
|
||||||
|
echo "## FRIENDS IPFS PINGing"
|
||||||
|
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=5s -n 3 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
## CHECK & (RE)ACTIVATE ipfs p2p tunnels
|
## CHECK & (RE)ACTIVATE ipfs p2p tunnels
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -162,11 +168,6 @@ if [[ $(($minute % 15)) == 0 ]]; then
|
||||||
## RESTORE index.html from /tmp/ipfsindex.html
|
## RESTORE index.html from /tmp/ipfsindex.html
|
||||||
[[ -f /tmp/ipfsindex.html ]] && mv /tmp/ipfsindex.html ~/.zen/ipfs/index.html
|
[[ -f /tmp/ipfsindex.html ]] && mv /tmp/ipfsindex.html ~/.zen/ipfs/index.html
|
||||||
|
|
||||||
## PING ALL MY FRIENDS TO ENHANCE SWARM CONNECTIVITY
|
|
||||||
echo "## FRIENDS IPFS PINGing"
|
|
||||||
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=5s -n 3 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# __ __ _____ ____
|
# __ __ _____ ____
|
||||||
|
|
|
@ -135,7 +135,7 @@ echo "####################################################"
|
||||||
# ipfs SWARM shaping
|
# ipfs SWARM shaping
|
||||||
[[ $(cat ~/.zen/A_my_swarm.txt | wc -l) -gt 0 ]] && ~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh && exit 0 || echo "SWARM LOST !! "
|
[[ $(cat ~/.zen/A_my_swarm.txt | wc -l) -gt 0 ]] && ~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh && exit 0 || echo "SWARM LOST !! "
|
||||||
|
|
||||||
|
## SHOULD HAVE exit 0 before !!
|
||||||
########################################################################
|
########################################################################
|
||||||
## SWARM LOST !! EMERGENCY RECOVERY !! TEST CODE
|
## SWARM LOST !! EMERGENCY RECOVERY !! TEST CODE
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
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
|
||||||
|
|
||||||
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
|
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
|
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||||
|
@ -33,7 +35,7 @@ do
|
||||||
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1id)
|
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1id)
|
||||||
|
|
||||||
echo "OK Friend REFRESH /ipns/$ipfsnodeid INTO ~/.zen/ipfs_swarm/"
|
echo "OK Friend REFRESH /ipns/$ipfsnodeid INTO ~/.zen/ipfs_swarm/"
|
||||||
ipfs --timeout=20s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
|
||||||
[[ -f /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid ]] && cat /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid || echo "NO ZUID"
|
[[ -f /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid ]] && cat /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/_xbian.zuid || echo "NO ZUID"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
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
|
||||||
|
|
||||||
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
|
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
|
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||||
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') || echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
|
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') || echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
|
||||||
|
@ -34,10 +37,10 @@ sleep 10
|
||||||
ipfs bootstrap rm --all
|
ipfs bootstrap rm --all
|
||||||
for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
|
for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
|
||||||
do
|
do
|
||||||
ipfsnodeid=${bootnode##*/}
|
ipfsnodeid=${bootnode##*/}
|
||||||
[[ "$ipfsnodeid" != "$IPFSNODEID" ]] && sleep 20 ## RALENTIR DEMARRAGE STATIONS NON BOOTSTRAP
|
[[ "$ipfsnodeid" != "$IPFSNODEID" ]] && sleep 20 ## RALENTIR DEMARRAGE STATIONS NON BOOTSTRAP
|
||||||
## ADD $bootnode TO BOOTSTRAP
|
## ADD $bootnode TO BOOTSTRAP
|
||||||
ipfs bootstrap add $bootnode
|
ipfs bootstrap add $bootnode
|
||||||
done
|
done
|
||||||
|
|
||||||
## STOP FOR $1 sec
|
## STOP FOR $1 sec
|
||||||
|
|
Loading…
Reference in New Issue