DEFCON3 takes too much time with fail2ban. DEFCON5. ping & FRIENDS swarm sync more regularly

This commit is contained in:
fred 2021-08-05 23:57:29 +02:00
parent 25b414c69c
commit ebd47017c3
5 changed files with 25 additions and 19 deletions

2
DEFCON
View File

@ -1 +1 @@
4
5

View File

@ -11,6 +11,8 @@
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
source $HOME/.profile
# CORRECT PATH
@ -92,6 +94,10 @@ fi
# RUN TIME $runtime
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
########################################################################
@ -162,11 +168,6 @@ if [[ $(($minute % 15)) == 0 ]]; then
## RESTORE index.html from /tmp/ipfsindex.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
# __ __ _____ ____

View File

@ -135,7 +135,7 @@ echo "####################################################"
# 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 !! "
## SHOULD HAVE exit 0 before !!
########################################################################
## SWARM LOST !! EMERGENCY RECOVERY !! TEST CODE
########################################################################

View File

@ -7,6 +7,8 @@
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
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
@ -20,20 +22,20 @@ IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
########################################################################
########################################################################
## SYNC WITH FRIENDS
# _____ ____ ___ _____ _ _ ____
# | ___| _ \|_ _| ____| \ | | _ \
# _____ ____ ___ _____ _ _ ____
# | ___| _ \|_ _| ____| \ | | _ \
# | |_ | |_) || || _| | \| | | | |
# | _| | _ < | || |___| |\ | |_| |
# |_| |_| \_\___|_____|_| \_|____/
#
#
# |_| |_| \_\___|_____|_| \_|____/
#
#
for g1id in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS);
do
[[ "$g1id" == "index.html" ]] && continue
ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1id)
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"
done

View File

@ -7,6 +7,9 @@
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
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
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') || echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
@ -17,7 +20,7 @@ IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') || echo 'ERROR missing IPFS Node
########################################################################
echo '
___ _ _ __ __ _
___ _ _ __ __ _
| |_)|_(_ (_\ //\ |_)|\/|
_|_| | __) __)\/\//--\| \| | renew
@ -30,14 +33,14 @@ rm -f ~/.zen/ipfs/.$IPFSNODEID/.switch
sudo systemctl stop ipfs
sleep 10
## RESTORE BOOTSTRAP
## RESTORE BOOTSTRAP
ipfs bootstrap rm --all
for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
do
ipfsnodeid=${bootnode##*/}
[[ "$ipfsnodeid" != "$IPFSNODEID" ]] && sleep 20 ## RALENTIR DEMARRAGE STATIONS NON BOOTSTRAP
## ADD $bootnode TO BOOTSTRAP
ipfs bootstrap add $bootnode
ipfsnodeid=${bootnode##*/}
[[ "$ipfsnodeid" != "$IPFSNODEID" ]] && sleep 20 ## RALENTIR DEMARRAGE STATIONS NON BOOTSTRAP
## ADD $bootnode TO BOOTSTRAP
ipfs bootstrap add $bootnode
done
## STOP FOR $1 sec