@ -36,20 +36,33 @@ fi
## CONTROL IPFS IS RUNNING OR RESTART
YOU = $( ps auxf --sort= +utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
if [ [ ! ${ YOU } ] ] ; then
# Refresh Peering.Peers
ipfs config --json Peering.Peers '[]'
# DHT PUBSUB mode
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE = 1/2 available
availableDiskSize = $( df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}' )
diskSize = " $(( availableDiskSize / 2 )) "
ipfs config Datastore.StorageMax $diskSize
## Activate Rapid "ipfs p2p"
ipfs config --json Experimental.Libp2pStreamMounting true
ipfs config --json Experimental.P2pHttpProxy true
# control water levels for swarm
ipfs config --json Swarm.ConnMgr.LowWater 50
ipfs config --json Swarm.ConnMgr.HighWater 100
[ $howmany -gt 3 ] && [ [ " ${ USER } " = = "xbian" ] ] && sudo service ipfs restart || sudo systemctl restart ipfs
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
exit 1
fi
########################################################################
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE : TODO DEBUG KODI PLUGIN !!!
[ [ ! -f ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ] ] && [ [ -f ~/.zen/astroport.py ] ] && cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
[ [ ! -f ~/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ] ] && cp ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ~/.kodi/addons/plugin.video.vstream/resources/art/ 2>/dev/null
########################################################################
### NO IP GATEWAY : EXIT
### NO IP GATEWAY : EXIT (COULD BE Astroport.ONE Ambassy Alone !!)
ping -q -w 1 -c 1 ` ip r | grep default | cut -d ' ' -f 3` 2>& 1>/dev/null && echo "LAN OK" || exit 1
########################################################################
@ -116,7 +129,7 @@ if [[ $(($runtime % 4)) == 0 ]]; then
[ [ $g1pub ] ] && latency = $( ipfs ping --timeout= 1s -n 1 /p2p/$( ~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1pub 2>/dev/null) 2>/dev/null | grep "Average" | cut -d ':' -f 2) ;
[ [ $latency ] ] && echo $latency > ~/.zen/ipfs/.$IPFSNODEID /FRIENDS/$g1pub /ping.average.txt
## AVERAGE PING cat ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/*/ping.average.txt
# for line in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/*/ping.average.txt); do g1friend=$(echo $line | cut -d '/' -f 8); ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1friend); cat ~/.zen/ipfs_swarm/.$ipfsnodeid/ _xbian.zuid ; cat $line; done
# for line in $(ls ~/.zen/ipfs/.$IPFSNODEID/FRIENDS/*/ping.average.txt); do g1friend=$(echo $line | cut -d '/' -f 8); ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $g1friend); cat ~/.zen/ipfs_swarm/.$ipfsnodeid/ .player ; cat $line; done
done
fi
########################################################################
@ -162,7 +175,7 @@ if [[ $(($runtime % 15)) == 0 ]]; then
## IN CASE OF jaklis UPGRADE ACTIVATE AND REMOVE
## cd ~/.zen/astrXbian/zen/jaklis; ./setup.sh; cd -
# CLEAN AND REMOVE BAD DIRECTORIES
# CLEAN AND REMOVE BAD DIRECTORIES should be in .$IPFSNODEID to avoid Station collision.
## BYPASS index.html DELETION
[ [ -f ~/.zen/ipfs/index.html ] ] && cp ~/.zen/ipfs/index.html /tmp/ipfsindex.html
@ -183,18 +196,6 @@ if [[ $(($runtime % 15)) == 0 ]]; then
fi
if [ [ $(( $minute % 30 )) = = 0 ] ] ; then
########## NextCloud.SMS GUILDE STATION ##############
if [ [ -e /home/${ YOU } /.zen/SMS/ ] ] ; then
# DONE at 20h01 in taurus crontab
# [[ "$timebar" == "18:30" ]] && /home/${YOU}/.zen/SMSAPP/sms/_SEND2GUILDE.sh "BIODYN" ## PREPARE BIODYN GUILDE SMS => 20h30 in France
/home/${ YOU } /.zen/SMSAPP/sms_send_tosend.sh
fi
########## BUNKERBOX STATION ##############
# [[ $(cat /home/${YOU}/.zen/bunkerbox/qo-op 2>/dev/null) != "" && $(cat /home/${YOU}/.zen/bunkerbox/choice 2>/dev/null) == "qo-op" ]] && /home/${YOU}/workspace/bunkerbox/crowdbunker.sh &
fi
# __ __ _____ ____
# __/ // /_/ ___/ ______ __________ ___ / __ \
# /_ _ __/\__ \ | /| / / __ `/ ___/ __ `__ \/ / / /
@ -222,8 +223,8 @@ if [[ $(($runtime % 370)) == 0 || "$runtime" == "10" ]]; then
$MY_PATH /zen/gchange_IPFS_swarm.sh 2>& 1 > /home/${ YOU } /.zen/ipfs/.${ IPFSNODEID } /.log.gchange_IPFS_swarm.txt
fi
# SYNC IPFS FRIENDS SWARM
if [ [ $(( $runtime % 2 5 )) = = 0 ] ] ; then
kill -9 $( ps auxf --sort= +utime | grep -w p4n.swarmscraper .sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}' ) && echo "KILLING p4n.swarmscraper .sh"
if [ [ $(( $runtime % 2 6 )) = = 0 ] ] ; then
kill -9 $( ps auxf --sort= +utime | grep -w ipfs_SWARM_refresh .sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}' ) && echo "KILLING ipfs_SWARM_refresh .sh"
killall chromium
$MY_PATH /zen/ipfs_SWARM_refresh.sh 2>& 1 > /home/${ YOU } /.zen/ipfs/.${ IPFSNODEID } /.log.ipfs_SWARM_refresh.txt
fi
@ -237,6 +238,8 @@ fi
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
### IMPORTANT !!!!!!! IMPORTANT !!!!!! Maintains MEDIAKEY alive
################################################
if [ [ $(( $runtime % 7 )) = = 0 ] ] ; then
#### Refresh & publish MEDIAKEYs
@ -259,6 +262,7 @@ fi
#
# 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
## TEST AUTOMATIC NEW FILE IMPORT. xbian only.
if [ [ " $USER " = = "xbian" ] ] ; then
[ [ ! -e $HOME /astroport ] ] && mkdir -p $HOME /astroport
# VERIFY LAUNCH inotifywait ?!