DISAPEAR ONE HOUR FROM IPFS SWARM ZOMBIES > 300 peers in swarm

This commit is contained in:
qo-op 2021-05-23 02:48:11 +02:00
parent 43108bf5f8
commit 48d86ceb67
1 changed files with 40 additions and 29 deletions

View File

@ -65,36 +65,41 @@ weeknumber=$(date +%V)
# WAKEUP TIME
if [[ ! -f /tmp/A_Station_ON ]]; then
echo "onheure=$heure; onminute=$minute; ontimebar=$timebar" > /tmp/A_Station_ON
echo "onheure=$heure; onminute=$minute; ontimebar=$timebar" > /tmp/A_Station_ON
else
source /tmp/A_Station_ON
old=$ontimebar
new=$timebar
# feeding variables by using read and splitting with IFS
IFS=: read old_hour old_min <<< "$old"
IFS=: read hour min <<< "$new"
# convert hours to minutes
# the 10# is there to avoid errors with leading zeros
# by telling bash that we use base 10
total_old_minutes=$((10#$old_hour*60 + 10#$old_min))
total_minutes=$((10#$hour*60 + 10#$min))
runtime=$((total_minutes - total_old_minutes))
source /tmp/A_Station_ON
old=$ontimebar
new=$timebar
# feeding variables by using read and splitting with IFS
IFS=: read old_hour old_min <<< "$old"
IFS=: read hour min <<< "$new"
# convert hours to minutes
# the 10# is there to avoid errors with leading zeros
# by telling bash that we use base 10
total_old_minutes=$((10#$old_hour*60 + 10#$old_min))
total_minutes=$((10#$hour*60 + 10#$min))
runtime=$((total_minutes - total_old_minutes))
fi
# RUN TIME $runtime
echo "$runtime ($timebar)"
echo "RUNTIME $runtime mn ($timebar)"
########################################################################
# STATION CAN MODIFY DEFCON (cool 5 to 1 war) - only 5 and 4 (fail2ban) are ready to use.
[[ -f ~/.zen/DEFCON ]] && export DEFCON=$(cat ~/.zen/DEFCON) || export DEFCON=$(cat ~/.zen/astrXbian/DEFCON) # ADAPT $DEFCON scenario
## DEFCON SYSTEM ACTIVATED
########################################################################
# SMARM SYNCRONISATION
########################################################################
# ____ _______ __ __
# / __ \/ ____/ | / / ____ ___ ____ ____/ /__
# / / / / __/ | | / / / __ `__ \/ __ \/ __ / _ \
# / /_/ / /___ | |/ / / / / / / / /_/ / /_/ / __/
# /_____/_____/ |___/ /_/ /_/ /_/\____/\__,_/\___/
#
#
# astrXbian TestNET
########################################################################
# ACTIVATE 15-17 MN "git pull" update
if [[ $(($minute % 15)) == 0 ]]; then
########## DESYNCH SWARM NODE REQUESTS #################
@ -127,7 +132,7 @@ if [[ $(($minute % 15)) == 0 ]]; then
exit 1
fi
########## OPEN OR CLOSE SSH ACCESS #################
########## CHATON : OPEN OR CLOSE SSH ACCESS #################
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" == "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # OPEN-SSH
# [[ "$(ipfs p2p ls | grep $G1PUB-ssh)" != "" ]] && sleep $((1 + RANDOM % 10)) && ~/.zen/astrXbian/zen/ssh_forward2onelove.sh # CLOSE-SSH
fi
@ -146,7 +151,8 @@ fi
# QUICK SYNC SWARM EVERY 20 minutes +/- 1 minute
# [[ $(($runtime % 20)) == 0 ]] && $MY_PATH/zen/ipfs_SWARM_refresh.sh "quick" &
# ~/astroport
# ACTIVATE ~/astroport directory monitoring
###
# _ _
# __ _| |__ (_) __ _ _ __
# \ \/ / '_ \| |/ _` | '_ \
@ -167,24 +173,26 @@ fi
##########################################################
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || $(($runtime % 720)) == 0 ]]; then
#### timebar DESYNC
# Restarting IPFS daemon
[[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs && sleep 10
[[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs
#### timebar DESYNC
sleep $((1 + RANDOM % 5))
##################################################################
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing KEY ZenTAG nano DHTs => Zen File ECONOMY door
#### Refresh & publish MEDIAKEYs
$MY_PATH/zen/ipns_TAG_refresh.sh
## RESCAN dead swarm
## REINIT dead swarm
rm -f ~/.zen/A_dead_swarm.txt
fi
@ -256,8 +264,11 @@ echo '
fi
### DISAPEAR ONE HOUR FROM IPFS SWARM ZOMBIES > 300 peers in swarm
if [[ $(cat /tmp/ipfs_swarm_peers | wc -l) -gt 300 ]]; then
if [[ "$timebar" == "04:05" ]]; then
~/.zen/astrXbian/zen/ipfs_SWARM_renew.sh 3600 ## CUT IPFS FOR ONE HOUR
## SWITCHING ON
echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch
fi
fi