From f31891acb6d3649ad70e8b9aa86aeeaaf3d35c8a Mon Sep 17 00:00:00 2001 From: qo-op Date: Sat, 23 May 2020 03:28:26 +0200 Subject: [PATCH] g1sms LOVELAND ENTRANCE published on http://127.0.0.1:10099/sms_loveland.php --- cron_MINUTE.sh | 50 +++++++++++++++++++----------------------- zen/ipfs_OPEN_ports.sh | 4 ++-- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 3cbcbf8..ef93ff4 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -7,10 +7,14 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" - +cd $MY_PATH #### - -# Add search in code "TODO". +export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" +export IPFSNODEID=$(ipfs id -f='\n') || er+=" ipfs id problem" +export WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem" +[[ "$YOU" == "" || "$IPFSNODEID" == "" || "$WHOAMI" == "" ]] && echo "ERROR : $er " && exit 1 +######################################################################## +# HELP DEVLT: Search "TODO" in code # Write what you thing about the situation # AND how you would like to 'fix it'... # Then friends can read and enhance solution. @@ -31,32 +35,24 @@ export isG1smsRunning=$(ps auxf --sort=+utime | grep -w gammu | grep -v -E 'colo # ? isNextcloudRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) ### DETECT FLAVOURS (TODO: Publish and share into ipfs/.Qm***/ ) ######################################################################## -[[ ! $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) ]] \ -&& echo "ipfs daemon not running. EXIT" \ -&& exit 1 # CORRECT PATH [[ ! $(echo $PATH | grep "/usr/local/bin") ]] && export PATH="$PATH:/usr/local/bin" [[ ! $(echo $PATH | grep "~/.local/bin") ]] && export PATH="$PATH:~/.local/bin" [[ ! $(echo $PATH | grep "/usr/games") ]] && export PATH="$PATH:/usr/games" -export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -export IPFSNODEID=$(ipfs id -f='\n') -ipfsnodeid=$(ipfs id -f='\n') -g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) - -# UNIVERSAL TIME (TODO ntpdate, but sudo problem... -# G1Tx. G1sms. G1Dab Zen economy needs precise time sync (RpiZero !!) -# Tx rates is limited by Station time synchronisation. +# WHAT UNIVERSAL TIME is it ? minute=$(date -u +%M) heure=$(date -u +%H) timebar="$heure:$minute" -jourdelasemaine=$(date +%w) -jourdumois=$(date +%d) -numerosemaine=$(date +%V) +dayoftheweek=$(date +%w) +dayofthemonth=$(date +%d) +weeknumber=$(date +%V) echo $timebar # TIME NTP SYNC: TODO: Problem being root (stickybit INSTALL?) +# G1Tx. G1sms. G1Dab Zen economy needs precise time sync (RpiZero !!) +# Tx rates is limited by Station time synchronisation. # sudo ntpdate ntp.pool.org # ____ _______ __ __ @@ -69,7 +65,6 @@ echo $timebar # ACTIVATE 5 MN "git pull" update if [[ $(($minute % 5)) == 0 ]]; then sleep $((1 + RANDOM % 12)) - cd $MY_PATH ### Remove files being in .gitignore # git checkout -- www/LOVELand/jukebox/prefs/collection.sq3 # git checkout -- www/LOVELand/jukebox/prefs/prefs.var @@ -125,16 +120,18 @@ randh=$((1 + RANDOM % 24)) # [[ $(($heure % $randh)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ssb_GET_zenyta.sh ################################################################## +################################################################## +# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE +if [[ "$timebar" == "00:01" ]]; then +echo ' # ____ ____ ____ ___ # / __ \/ __ \ _ / __ < / # / / / / / / / (_) / / / / / # / /_/ / /_/ / _ / /_/ / / # \____/\____/ (_) \____/_/ # -# Clean & Upgrade + Log rotation + git pull -################################################################## -# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE -if [[ "$timebar" == "00:01" ]]; then +# Clean & Upgrade + Log rotation + git pull + ipfs p2p port forward +' sleep $((1 + RANDOM % 10)) ### Be careful if random sleep is not activated... ############################## That swarm could become an aggressive blob !! ### PEACE & LOVE software is processing... We are HyperWeb people here. @@ -146,13 +143,12 @@ if [[ "$timebar" == "00:01" ]]; then sleep $((1 + RANDOM % 10)) # LOG ROTATE EVERY SUNDAY - [[ $jourdelasemaine == 0 ]] && mv -f /tmp/astroport.log ~/.zen/astroport.$numerosemaine.log # LOG BACKUP FOR 1 YEAR !! + [[ $dayoftheweek == 0 ]] && mv -f /tmp/astroport.log ~/.zen/astroport.$weeknumber.log # LOG BACKUP FOR 1 YEAR !! sleep $((1 + RANDOM % 10)) # GIT UPDATE ./git-update.sh - git pull # UPDATE CODE git pull # Clear 24h ssb_GET markers @@ -167,10 +163,10 @@ echo ' / /_/ // / (__ ) / / / / (__ ) \____//_/ /____/_/ /_/ /_/____/ -http://127.0.0.1:10099 +forwarding to http://127.0.0.1:10099 ' ipfs p2p close --all - $MY_PATH/zen/ipfs_OPEN_ports.sh + ./zen/ipfs_OPEN_ports.sh ipfs p2p ls fi @@ -186,7 +182,7 @@ fi # TODO: Read parameters from ipfs, publish status to swarm, could be use for youtube-dl or other kind of heavy ipfs input Station election. # -if [[ $jourdumois == 7 ]]; then +if [[ $dayofthemonth == 7 ]]; then availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}') diskSize="$((availableDiskSize / 2))" ipfs config Datastore.StorageMax $diskSize diff --git a/zen/ipfs_OPEN_ports.sh b/zen/ipfs_OPEN_ports.sh index 3f41599..af997c5 100755 --- a/zen/ipfs_OPEN_ports.sh +++ b/zen/ipfs_OPEN_ports.sh @@ -11,7 +11,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" IPFSNODEID=$(ipfs id -f='\n') || er+=" ipfs id problem" WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem" -[[ "$YOU" == "" || "$IPFSNODEID" == "" || "$WHOAMI" == "" ]] && echo "ERROR : $er " +[[ "$YOU" == "" || "$IPFSNODEID" == "" || "$WHOAMI" == "" ]] && echo "ERROR : $er " && exit 1 ######################################################################## # TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour) @@ -26,7 +26,7 @@ if [[ $(which gammu) ]]; then else # Looking for g1sms NODE in my swarm SMSNODE=$(ls /home/$YOU/.zen/ipfs_swarm/.Qm*/G1SSB/_g1sms | shuf -n 1 | cut -d '/' -f 6 | cut -d '.' -f 2) - sleep 10 # Wait for DHT to propagate.... Then forward /x/g1sms + sleep $((1 + RANDOM % 10)) # Wait for DHT to propagate.... Then forward /x/g1sms [[ $SMSNODE ]] && ipfs p2p forward /x/g1sms /ip4/127.0.0.1/tcp/10099 /p2p/$SMSNODE fi