writing in code comments. please read
This commit is contained in:
parent
cd53eeed62
commit
6af6406b2e
|
@ -84,26 +84,26 @@ fi
|
||||||
# RUN TIME $runtime
|
# RUN TIME $runtime
|
||||||
|
|
||||||
echo "RUNTIME $runtime mn ($timebar)"
|
echo "RUNTIME $runtime mn ($timebar)"
|
||||||
|
########################################################################
|
||||||
## CHECK & (RE)ACTIVATE ipfs p2p tunnels
|
## CHECK & (RE)ACTIVATE ipfs p2p tunnels
|
||||||
|
########################################################################
|
||||||
# NextCloud FROM taurus TO oasis (https://taurus.copylaradio.com)
|
# NextCloud FROM taurus TO oasis (https://taurus.copylaradio.com)
|
||||||
~/.zen/astrXbian/zen/ipfs_P2P_forward.sh
|
~/.zen/astrXbian/zen/ipfs_P2P_forward.sh
|
||||||
|
########## SUPPORT : 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
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# DEFCON
|
||||||
########################################################################
|
########################################################################
|
||||||
# STATION CAN MODIFY DEFCON (cool 5 to 1 war) - only 5 and 4 (fail2ban) are ready to use.
|
# 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
|
[[ -f ~/.zen/DEFCON ]] && export DEFCON=$(cat ~/.zen/DEFCON) || export DEFCON=$(cat ~/.zen/astrXbian/DEFCON) # ADAPT $DEFCON scenario
|
||||||
## DEFCON SYSTEM ACTIVATED
|
## DEFCON SYSTEM ACTIVATED
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# SMARM SYNCRONISATION
|
# SMARM MAINTENANCE / 15 mn
|
||||||
########################################################################
|
########################################################################
|
||||||
# ____ _______ __ __
|
# astrXbian TestNET (git pull) -> desactivate in release ipfs get codeID
|
||||||
# / __ \/ ____/ | / / ____ ___ ____ ____/ /__
|
|
||||||
# / / / / __/ | | / / / __ `__ \/ __ \/ __ / _ \
|
|
||||||
# / /_/ / /___ | |/ / / / / / / / /_/ / /_/ / __/
|
|
||||||
# /_____/_____/ |___/ /_/ /_/ /_/\____/\__,_/\___/
|
|
||||||
#
|
|
||||||
# astrXbian TestNET
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# ACTIVATE 15-17 MN "git pull" update
|
# ACTIVATE 15-17 MN "git pull" update
|
||||||
if [[ $(($minute % 15)) == 0 ]]; then
|
if [[ $(($minute % 15)) == 0 ]]; then
|
||||||
|
@ -118,21 +118,25 @@ if [[ $(($minute % 15)) == 0 ]]; then
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# CLEAN AND REMOVE BAD DIRECTORIES
|
# CLEAN AND REMOVE BAD DIRECTORIES
|
||||||
|
## BYPASS index.html DELETION
|
||||||
[[ -f ~/.zen/ipfs/index.html ]] && cp ~/.zen/ipfs/index.html /tmp/ipfsindex.html
|
[[ -f ~/.zen/ipfs/index.html ]] && cp ~/.zen/ipfs/index.html /tmp/ipfsindex.html
|
||||||
|
|
||||||
[[ -d ~/.zen/ipfs/astroport ]] && rm -Rf ~/.zen/ipfs/astroport
|
[[ -d ~/.zen/ipfs/astroport ]] && rm -Rf ~/.zen/ipfs/astroport
|
||||||
[[ -d ~/.zen/ipfs_swarm/astroport ]] && rm -Rf ~/.zen/ipfs_swarm/astroport
|
[[ -d ~/.zen/ipfs_swarm/astroport ]] && rm -Rf ~/.zen/ipfs_swarm/astroport
|
||||||
[[ -d ~/.zen/ipfs/xbian ]] && rm -Rf ~/.zen/ipfs/xbian
|
[[ -d ~/.zen/ipfs/xbian ]] && rm -Rf ~/.zen/ipfs/xbian
|
||||||
[[ -d ~/.zen/ipfs_swarm/xbian ]] && rm -Rf ~/.zen/ipfs_swarm/xbian
|
[[ -d ~/.zen/ipfs_swarm/xbian ]] && rm -Rf ~/.zen/ipfs_swarm/xbian
|
||||||
[[ -d ~/.zen/ipfs/PIN ]] && rm -Rf ~/.zen/ipfs/PIN
|
[[ -d ~/.zen/ipfs/PIN ]] && rm -Rf ~/.zen/ipfs/PIN
|
||||||
[[ -d ~/.zen/ipfs_swarm/PIN ]] && rm -Rf ~/.zen/ipfs_swarm/PIN
|
[[ -d ~/.zen/ipfs_swarm/PIN ]] && rm -Rf ~/.zen/ipfs_swarm/PIN
|
||||||
## CLEANING OLD BAD FILES
|
## CLEANING PARASITE BAD FILES
|
||||||
rm ~/.zen/ipfs/*
|
rm ~/.zen/ipfs/*
|
||||||
rm ~/.zen/ipfs/.*
|
rm ~/.zen/ipfs/.*
|
||||||
rm ~/.zen/ipfs_swarm/*
|
rm ~/.zen/ipfs_swarm/*
|
||||||
rm ~/.zen/ipfs_swarm/.*
|
rm ~/.zen/ipfs_swarm/.*
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
## CONTROL IPFS IS RUNNING OR RESTART
|
||||||
isIPFSRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
isIPFSRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
||||||
if [[ ! $isIPFSRunning ]]; then
|
if [[ ! $isIPFSRunning ]]; then
|
||||||
[[ -f /etc/sudoers.d/systemctl && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs
|
[[ -f /etc/sudoers.d/systemctl && -f ~/.zen/ipfs/.$IPFSNODEID/.switch ]] && sudo systemctl restart ipfs
|
||||||
|
@ -140,12 +144,10 @@ if [[ $(($minute % 15)) == 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## PING ALL MY FRIENDS
|
||||||
echo "## FRIENDS IPFS PINGing"
|
echo "## FRIENDS IPFS PINGing"
|
||||||
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=7s -n 5 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
|
for g1pub in $(ls -t ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/); do [[ $g1pub ]] && ipfs ping --timeout=7s -n 5 /ipfs/$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null; done
|
||||||
|
|
||||||
########## 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
|
fi
|
||||||
|
|
||||||
# __ __ _____ ____
|
# __ __ _____ ____
|
||||||
|
@ -156,13 +158,15 @@ fi
|
||||||
#
|
#
|
||||||
##################################################################
|
##################################################################
|
||||||
# TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level !
|
# TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level !
|
||||||
# SYNC GCHANGE EVERY 1 hour runtime
|
## SYNC GCHANGE EVERY 1 hour runtime
|
||||||
[[ $(($runtime % 60)) == 0 ]] && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh &
|
[[ $(($runtime % 60)) == 0 ]] && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh &
|
||||||
|
|
||||||
# QUICK SYNC SWARM EVERY 20 minutes +/- 1 minute
|
# QUICK SYNC SWARM EVERY 20 minutes +/- 1 minute
|
||||||
# [[ $(($runtime % 20)) == 0 ]] && $MY_PATH/zen/ipfs_SWARM_refresh.sh "quick" &
|
# [[ $(($runtime % 20)) == 0 ]] && $MY_PATH/zen/ipfs_SWARM_refresh.sh "quick" &
|
||||||
|
|
||||||
# ACTIVATE ~/astroport directory monitoring
|
########################################################################
|
||||||
|
# ACTIVATE ~/astroport directory monitoring (xbian only)
|
||||||
|
########################################################################
|
||||||
###
|
###
|
||||||
# _ _
|
# _ _
|
||||||
# __ _| |__ (_) __ _ _ __
|
# __ _| |__ (_) __ _ _ __
|
||||||
|
@ -173,7 +177,7 @@ fi
|
||||||
# ON Rpi/xbian files added in ~/astroport are monitored to activate "new_file_in_astroport.sh"
|
# ON Rpi/xbian files added in ~/astroport are monitored to activate "new_file_in_astroport.sh"
|
||||||
# Transfert ~/astroport/*/files to IPFS and make Astroport/KODI indexes in IPNS
|
# Transfert ~/astroport/*/files to IPFS and make Astroport/KODI indexes in IPNS
|
||||||
if [[ "$USER" == "xbian" ]]; then
|
if [[ "$USER" == "xbian" ]]; then
|
||||||
[[ ! -e /home/$USER/astroport ]] && mkdir -p /home/$USER/astroport
|
[[ ! -e $HOME/astroport ]] && mkdir -p $HOME/astroport
|
||||||
# VERIFY LAUNCH inotifywait ?!
|
# VERIFY LAUNCH inotifywait ?!
|
||||||
inotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -w astroport | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
inotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -w astroport | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
||||||
if [[ "$inotifywaitRunning" != "xbian" ]]
|
if [[ "$inotifywaitRunning" != "xbian" ]]
|
||||||
|
@ -192,7 +196,7 @@ fi
|
||||||
# / /_/ __/ / / / / / / ___ / /_/ /
|
# / /_/ __/ / / / / / / ___ / /_/ /
|
||||||
# /___/\___/_/ /_/ /_/ /_/ |_\____/
|
# /___/\___/_/ /_/ /_/ /_/ |_\____/
|
||||||
#
|
#
|
||||||
# REFRESHing MEDIAKEY ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
|
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
|
||||||
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
|
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
|
||||||
# Every 12h runtime restarting IPFS daemon
|
# Every 12h runtime restarting IPFS daemon
|
||||||
[[ $(($runtime % 720)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs && sleep $((12 + RANDOM % 20))
|
[[ $(($runtime % 720)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl || "$USER" == "xbian" ]] && sudo systemctl restart ipfs && sleep $((12 + RANDOM % 20))
|
||||||
|
@ -200,13 +204,13 @@ if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || $(($runtime % 720)) == 0
|
||||||
#### Refresh & publish MEDIAKEYs
|
#### Refresh & publish MEDIAKEYs
|
||||||
$MY_PATH/zen/ipns_TAG_refresh.sh
|
$MY_PATH/zen/ipns_TAG_refresh.sh
|
||||||
|
|
||||||
## REINIT dead swarm
|
## REINIT dead swarm STATIONS
|
||||||
rm -f ~/.zen/A_dead_swarm.txt
|
rm -f ~/.zen/A_dead_swarm.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
##################################################################
|
##################################################################
|
||||||
# MIDNIGHT:01 : CLEANING & UPDATE
|
# 5 mn / 24h REBOOT & MIDNIGHT:01 : CLEANING & UPDATE
|
||||||
##################################################################
|
##################################################################
|
||||||
##################################################################
|
##################################################################
|
||||||
if [[ "$timebar" == "00:01" || "$runtime" == "5" || $(($runtime % 1380)) == 0 ]]; then
|
if [[ "$timebar" == "00:01" || "$runtime" == "5" || $(($runtime % 1380)) == 0 ]]; then
|
||||||
|
@ -250,8 +254,8 @@ echo '
|
||||||
# New full test review in gchange_INIT.sh
|
# New full test review in gchange_INIT.sh
|
||||||
rm -f ~/.ipfs/test.disk
|
rm -f ~/.ipfs/test.disk
|
||||||
|
|
||||||
# LOG ROTATE
|
# LOG ROTATE WEEKLY
|
||||||
[[ -f /tmp/astroport.log ]] && tar cvzf ~/.zen/astroport.$weeknumber.log.tgz /tmp/astroport.log && echo "" > /tmp/astroport.log
|
[[ -f /tmp/astroport.log ]] && [[ ! -f ~/.zen/astroport.$weeknumber.log.tgz ]] && tar cvzf ~/.zen/astroport.$weeknumber.log.tgz /tmp/astroport.log && echo "" > /tmp/astroport.log
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -280,3 +284,4 @@ fi
|
||||||
# echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch
|
# echo "1" > ~/.zen/ipfs/.$IPFSNODEID/.switch
|
||||||
#fi
|
#fi
|
||||||
#fi
|
#fi
|
||||||
|
## BETTER ACTIVATING DEFCON 3 / swarm.key MODE
|
||||||
|
|
Loading…
Reference in New Issue