From 52040dae78a13117d44830fc23c656bfc4b0d954 Mon Sep 17 00:00:00 2001 From: qo-op Date: Thu, 30 Apr 2020 00:17:58 +0200 Subject: [PATCH] desynch 00:01 upgrade with sleep $((1 + RANDOM % 10)) --- .install/scuttlebutt.sh | 19 +++++++++++------- zen/cron_MINUTE.sh | 6 +++++- zen/tools/make_G1SSB_secret.sh | 36 ++++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/.install/scuttlebutt.sh b/.install/scuttlebutt.sh index 4c041bc..42a47a4 100755 --- a/.install/scuttlebutt.sh +++ b/.install/scuttlebutt.sh @@ -54,6 +54,7 @@ scuttlebutt() { # Symlink ~/.ssb -> ~/.ssb_astroport [[ -L ~/.ssb ]] && rm ~/.ssb [[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb + printf '{"manifest":"sync"}' > ~/.ssb/manifest.json # Create config (TODO: adapt if public Pub or Local Node) # TODO: Create unique hostname in swarm !! uidna @@ -146,8 +147,7 @@ EOF # REPLACE _ with $ sed -i s/_/\$/g ~/.zen/run-ssb_server.sh chmod 755 ~/.zen/run-ssb_server.sh - ssb-server start --host $nodename & - + ssb-server start & fi @@ -165,12 +165,17 @@ $nodename __)|_| \ \/ |_| \ || || |_ ... SCUTTLEBUTT ... OK? ' - echo "DOES SCUTTELBUTT IS RUNNING FINE?" - echo "CHECK and ADD $HOME/.zen/run-ssb_server.sh & TO '/etc/rc.local' !!! " - echo "OASIS NODE MANAGER http://$nodename:3000" + echo "DOES ssb-server IS RUNNING FINE?" + echo "YOU CAN CHOOSE ssb-daemon INSTEAD..." + + echo "ADD TO YOUR '/etc/rc.local' !!! " + echo "LAUNCHING OASIS NODE MANAGER http://$nodename:3000" + sbotc -t async manifest > ~/.ssb/manifest.json oasis --allow-host $nodename --host $nodename & - # TODO: Protect behind nginx redirect !!! - echo "WAIT 10 seconds before ssb_INIT.sh" + + echo "TODO: Protect behind nginx redirect !!!" + + echo "WAIT 10 seconds then ssb_INIT.sh" sleep 10 $MY_PATH/zen/ssb_INIT.sh diff --git a/zen/cron_MINUTE.sh b/zen/cron_MINUTE.sh index ca7e540..7c4760d 100755 --- a/zen/cron_MINUTE.sh +++ b/zen/cron_MINUTE.sh @@ -49,13 +49,17 @@ randh=$((1 + RANDOM % 24)) ################################################################## # MIDNIGHT:01 : ZENBOT CLEANING & UPDATE if [[ "$timebar" == "00:01" ]]; then + sleep $((1 + RANDOM % 10)) + # UPGRADE youtube-dl youtube-dl --rm-cache-dir youtube-dl -U - + + sleep $((1 + RANDOM % 10)) # LOG ROTATE EVERY SUNDAY [[ $jourdelasemaine == 0 ]] && mv -f /tmp/astroport.log ~/.zen/astroport.$numerosemaine.log # LOG BACKUP FOR 1 YEAR !! + sleep $((1 + RANDOM % 10)) # GIT PULL cd $MY_PATH/../ && git pull && cd $MY_PATH # UPDATE CODE git pull diff --git a/zen/tools/make_G1SSB_secret.sh b/zen/tools/make_G1SSB_secret.sh index eb7455e..718b319 100755 --- a/zen/tools/make_G1SSB_secret.sh +++ b/zen/tools/make_G1SSB_secret.sh @@ -33,10 +33,38 @@ fi if [[ -d ~/.ssb ]]; then - echo "ScuttelButt is already installed..." - echo "Do you want to remove ~/.ssb ? (y)/n" + echo "ScuttleButt is already installed..." + echo "Do you want to create a new ~/.ssb identity ? (y)/n" read isitok - if [[ "$isitok" == "y" ]]; then rm -Rf ~/.ssb; else echo "You must remove '~/.ssb' before running $ME"; exit 1; fi + if [[ "$isitok" == "y" ]]; then + + # TEST ssb-server Install + ssbSERVER=$(which ssb-server) + + # If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !) + [[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... ~/.ssb_$USER !!! Manual check please..." && exit 1 + + [[ $ssbSERVER == "" ]] && echo "Check your ssb-server install... Cannot find it !!" && exit 1 \ + || kill -9 $(ps auxf --sort=+utime | grep -w ssb-server| grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') + + [[ -d ~/.ssb ]] && [[ ! -d ~/.ssb_$USER ]] && mv ~/.ssb ~/.ssb_$USER + + # CREATE ~/.ssb_astroport + [[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport && cd ~/.ssb_astroport + + # Symlink ~/.ssb -> ~/.ssb_astroport + [[ -L ~/.ssb ]] && rm ~/.ssb + [[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb + + # INITIALISE manifest + printf '{"manifest":"sync"}' > ~/.ssb/manifest.json + ssb-server start & + sbotc -t async manifest > ~/.ssb/manifest.json + + else + echo "You must remove '~/.ssb' before running $ME"; + exit 1; + fi fi mkdir -p ~/.ssb @@ -107,7 +135,7 @@ echo " Your G1SSB KEY is made !! -# Social App +# Your SSB ID is @$ssbpub.ed25519 Install Patchwork : https://github.com/ssbc/patchwork/releases/ # Libre Money Wallet