code speed & myCODE consistency optimisation

This commit is contained in:
qo-op 2021-03-18 00:18:48 +01:00
parent d118b196cb
commit cd9328b659
2 changed files with 35 additions and 45 deletions

View File

@ -77,7 +77,7 @@ echo $timebar
if [[ $(($minute % 15)) == 0 ]]; then
########## DESYNCH SWARM NODE REQUESTS #################
sleep $((1 + RANDOM % 120))
git pull
git reset --hard && git pull
# if [[ $(diff ~/.zen/astrXbian/.install/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml ~/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml) ]]; then
# cp ~/.zen/astrXbian/.install/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml ~/.kodi/userdata/addon_data/plugin.video.vstream/settings.xml
@ -96,15 +96,15 @@ fi
#
##################################################################
#
# REFRESH IPFS SWARM DATA EVERY 20-23 minutes
# MAINTAIN FRESH LOCAL SWARM DATA EVERY 20-23 minutes
[[ $(($minute % 20)) == 0 ]] && sleep $((1 + RANDOM % 180)) && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh &
#
# ~/astroport
# _ _
# __ _| |__ (_) __ _ _ __
# \ \/ / '_ \| |/ _` | '_ \
# > <| |_) | | (_| | | | |
# /_/\_\_.__/|_|\__,_|_| |_| ASTROPORT inotifywait
# /_/\_\_.__/|_|\__,_|_| |_| inotifywait
#
# 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
@ -118,20 +118,7 @@ if [[ "$YOU" == "xbian" ]]; then
fi
fi
## TODO investigate could breaks "ipfs p2p" forwards ?
##################################################################
# _________ _______ __ _ __
# / ____< / /_ __/ |/ / ____ ___ ____ ____ (_) /_____ _____
# / / __ / / / / | / / __ `__ \/ __ \/ __ \/ / __/ __ \/ ___/
# / /_/ // / / / / | / / / / / / /_/ / / / / / /_/ /_/ / /
# \____//_/ /_/ /_/|_| /_/ /_/ /_/\____/_/ /_/_/\__/\____/_/
#
##################################################################
# MONITOR INPUT TX (NOT ACTIVATED YET)
# Activate ZenTx => File become a wallet PASSENGER with CONTRACT(s)
# [[ $(($minute % 5)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/g1_MONITOR_zen.sh "5 minutes"
##################################################################
##########################################################
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" ]]; then
#### DESYNC
@ -177,7 +164,7 @@ echo '
##################################################################
if [[ $dayoftheweek == 0 ]]; then
#
# EVERY SUNDAY
# _____ __ __ ___
# / ___// /_____ _________ _____ ____ / |/ /___ __ __
# \__ \/ __/ __ \/ ___/ __ `/ __ `/ _ \ / /|_/ / __ `/ |/_/
@ -189,7 +176,7 @@ echo '
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
echo "StorageMax = $diskSize"
rm -f ~/.ipfs/test.disk
# LOG ROTATE
[[ -f /tmp/astroport.log ]] && tar cvzf ~/.zen/astroport.$weeknumber.log.tgz /tmp/astroport.log && echo "" > /tmp/astroport.log

View File

@ -23,11 +23,6 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[[ $G1PUB == "" ]] && echo "ERROR G1PUB empty !! EXIT" && exit 1
########################################################################
# NODE DISK PERFORMANCE
[[ -f ~/.ipfs/test.disk ]] && rm -f ~/.ipfs/test.disk
diskperf=$(dd if=/dev/zero of=~/.ipfs/test.disk bs=10M count=1 oflag=dsync 2>&1 | tail -n 1 | sed s/\,\ /\ -/g | cut -d '-' -f 4)
echo "DISK PERFORMANCE TESTING : $diskperf"
########################################################################
# CREATNG IPFS LOCAL REPOSITORY for Node G1 Identity : G1SSB
@ -44,26 +39,20 @@ cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
GCHANGE="https://data.gchange.fr"
# CREATE _g1.gchange_title
rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
title=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.title')
curl -s ${GCHANGE}/user/profile/${G1PUB} > /tmp/A_${G1PUB}.cache
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
title=$(cat /tmp/A_${G1PUB}.cache | jq -r '._source.title')
[[ $title ]] && echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title
# CREATE _g1.astroport_title with city
rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
title="Station $USER@$(hostname)"
city=$(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.city')
city=$(cat /tmp/A_${G1PUB}.cache | jq -r '._source.city')
[[ "$city" != "null" ]] && title="$title in $city"
echo "$title" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.astroport_title
# DESACTIVATED
# CREATE "_g1.gchange_geoPoint.lat" AND "_g1.gchange_geoPoint.lon"
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lat') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lon') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
# CREATE _g1.gchange_avatar.png
curl -s ${GCHANGE}/user/profile/${G1PUB} | jq -r '._source.avatar._content' | base64 -d > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_avatar.png"
# GET _g1.gchange_avatar.png
cat /tmp/A_${G1PUB}.cache | jq -r '._source.avatar._content' | base64 -d > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_avatar.png"
# CREATE _nodename
[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename ]] && nodename=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nodename)
@ -82,16 +71,30 @@ export LANG=C.UTF-8 #attipix
# _g1.pubkey
[[ ! ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey ]] && echo "$G1PUB" > ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey
# TO REMOVE #######################################################################
# IPFS Adresses
ipfs id | jq -r .Addresses[] > ~/.zen/ipfs/.${IPFSNODEID}/Addresses
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/Addresses ]] && rm ~/.zen/ipfs/.${IPFSNODEID}/Addresses
# IPFS AgentVersion
ipfs id | jq -r .AgentVersion > ~/.zen/ipfs/.${IPFSNODEID}/AgentVersion
# IPFS repo.stat
ipfs repo stat > ~/.zen/ipfs/.${IPFSNODEID}/repo.stat
# NODE disk.perf
echo "$diskperf" > ~/.zen/ipfs/.${IPFSNODEID}/disk.perf
# NODE disk.bytes
echo $(df ~/.ipfs/ | tail -n 1 | awk '{print $4}') > ~/.zen/ipfs/.${IPFSNODEID}/disk.bytes
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/AgentVersion ]] && rm ~/.zen/ipfs/.${IPFSNODEID}/AgentVersion
########################################################################
# NODE DISK PERFORMANCE, manual remove ~/.ipfs/test.disk to run again
if [[ ! -f ~/.ipfs/test.disk ]]; then
diskperf=$(dd if=/dev/zero of=~/.ipfs/test.disk bs=10M count=1 oflag=dsync 2>&1 | tail -n 1 | sed s/\,\ /\ -/g | cut -d '-' -f 4)
echo "DISK PERFORMANCE TESTING : $diskperf"
# NODE disk.perf
echo "$diskperf" > ~/.zen/ipfs/.${IPFSNODEID}/disk.perf
# NODE disk.bytes
echo $(df ~/.ipfs/ | tail -n 1 | awk '{print $4}') > ~/.zen/ipfs/.${IPFSNODEID}/disk.bytes
# IPFS repo.stat
ipfs repo stat > ~/.zen/ipfs/.${IPFSNODEID}/repo.stat
# GEOLOC SHOULD BE SECURELY EXCHANGED
# CREATE "_g1.gchange_geoPoint.lat" AND "_g1.gchange_geoPoint.lon"
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lat') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lat
# rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
# echo $(curl -s ${GCHANGE}/user/profile/${G1PUB} | jq '._source.geoPoint.lon') > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_geoPoint.lon
fi
###
#### FRIENDS && BOOTSTRAP ipfstryme MESSAGE sending procedure