From cd9328b6599d5b5d849314f1128df37a85e03f8d Mon Sep 17 00:00:00 2001 From: qo-op Date: Thu, 18 Mar 2021 00:18:48 +0100 Subject: [PATCH] code speed & myCODE consistency optimisation --- cron_MINUTE.sh | 27 +++++++-------------------- zen/gchange_INIT.sh | 53 ++++++++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 5794caf..752beb7 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -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 diff --git a/zen/gchange_INIT.sh b/zen/gchange_INIT.sh index 76fb22c..37d0868 100755 --- a/zen/gchange_INIT.sh +++ b/zen/gchange_INIT.sh @@ -23,11 +23,6 @@ IPFSNODEID=$(ipfs id -f='\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