This commit is contained in:
qo-op 2020-05-18 03:58:04 +02:00
parent dd5748cd2c
commit d5466612cb
2 changed files with 26 additions and 12 deletions

View File

@ -8,19 +8,27 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}" ME="${0##*/}"
####
# Add search in code "TODO".
# Write what you thing about the situation
# AND how you would like to 'fix it'...
# Then friends can read and enhance solution.
# _ _____ ____ _ _______ ________ ____ # _ _____ ____ _ _______ ________ ____
# | | / / | / __ \/ | / / _/ | / / ____/ / / / # | | / / | / __ \/ | / / _/ | / / ____/ / / /
# | | /| / / /| | / /_/ / |/ // // |/ / / __ / / / # | | /| / / /| | / /_/ / |/ // // |/ / / __ / / /
# | |/ |/ / ___ |/ _, _/ /| // // /| / /_/ / /_/_/ # | |/ |/ / ___ |/ _, _/ /| // // /| / /_/ / /_/_/
# |__/|__/_/ |_/_/ |_/_/ |_/___/_/ |_/\____/ (_|_) # |__/|__/_/ |_/_/ |_/_/ |_/___/_/ |_/\____/ (_|_)
########################################################################
# NB: 'figlet' is used for labeling code trunks
######################################################################## ########################################################################
### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!! ### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!!
### EVERY STATION RUN THIS SCRIPT EVERY MINUTE. ### EVERY STATION RUN THIS SCRIPT EVERY MINUTE.
export isMinetestRunning=$(ps auxf --sort=+utime | grep -w minetest | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) export isMinetestRunning=$(ps auxf --sort=+utime | grep -w minetest | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
export isG1smsRunning=$(ps auxf --sort=+utime | grep -w gammu | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) export isG1smsRunning=$(ps auxf --sort=+utime | grep -w gammu | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
#isNextcloudRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) # ? isNextcloudRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
### ACTIVATE DIFFERENT FLAVOURS ### 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) ]] \ [[ ! $(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" \ && echo "ipfs daemon not running. EXIT" \
@ -32,19 +40,19 @@ export isG1smsRunning=$(ps auxf --sort=+utime | grep -w gammu | grep -v -E 'colo
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); 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='<id>\n') export IPFSNODEID=$(ipfs id -f='<id>\n')
ipfsnodeid=$(ipfs id -f='<id>\n') ipfsnodeid=$(ipfs id -f='<id>\n')
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
# UNIVERSAL TIME (TODO ntpdate, but sudo problem) # 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.
minute=$(date -u +%M) minute=$(date -u +%M)
heure=$(date -u +%H) heure=$(date -u +%H)
timebar="$heure:$minute" timebar="$heure:$minute"
jourdelasemaine=$(date +%w) jourdelasemaine=$(date +%w)
jourdumois=$(date +%d) jourdumois=$(date +%d)
numerosemaine=$(date +%V) numerosemaine=$(date +%V)
echo $timebar echo $timebar | lolcat
# TIME NTP SYNC: TODO: Problem being root (stickybit INSTALL?) # TIME NTP SYNC: TODO: Problem being root (stickybit INSTALL?)
# sudo ntpdate ntp.pool.org # sudo ntpdate ntp.pool.org
@ -95,7 +103,8 @@ echo $timebar
# /_ _ __/ / /_/ __/ / / / /_/ / /_ | |/ / # /_ _ __/ / /_/ __/ / / / /_/ / /_ | |/ /
# /_//_/ /___/\___/_/ /_/\__, /\__/ |___/ # /_//_/ /___/\___/_/ /_/\__, /\__/ |___/
# /____/ # /____/
# SSB message 2 "youtube-dl" # SSB message 2 "youtube-dl" EXPERIMENTAL
# TODO : Run on BIG STATIONS (Control available Disk Space !!)
################################################################## ##################################################################
# RANDOMLY RUN SSB GET zenytv (avoid simultaneous run in swarm) # RANDOMLY RUN SSB GET zenytv (avoid simultaneous run in swarm)
randh=$((1 + RANDOM % 24)) randh=$((1 + RANDOM % 24))
@ -115,8 +124,11 @@ randh=$((1 + RANDOM % 24))
################################################################## ##################################################################
# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE # MIDNIGHT:01 : ZENBOT CLEANING & UPDATE
if [[ "$timebar" == "00:01" ]]; then if [[ "$timebar" == "00:01" ]]; then
sleep $((1 + RANDOM % 10)) 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.
# DEFCON 5 code runin' please keep cool, take care and be zen
# UPGRADE youtube-dl # UPGRADE youtube-dl
youtube-dl --rm-cache-dir youtube-dl --rm-cache-dir
youtube-dl -U youtube-dl -U
@ -144,9 +156,11 @@ fi
# ___/ / /_/ /_/ / / / /_/ / /_/ / __/ / / / / /_/ /> < # ___/ / /_/ /_/ / / / /_/ / /_/ / __/ / / / / /_/ /> <
# /____/\__/\____/_/ \__,_/\__, /\___/ /_/ /_/\__,_/_/|_| # /____/\__/\____/_/ \__,_/\__, /\___/ /_/ /_/\__,_/_/|_|
# /____/ # /____/
# Always 1/2 HDD for IPFS size - dicotomic adaptation # 1/2 HDD for IPFS size - dicotomic adaptation 7th EVERY MONTH
# UPDATE ON 7th EVERY MONTH #
# 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 [[ $jourdumois == 7 ]]; then
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}') availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))" diskSize="$((availableDiskSize / 2))"

View File

@ -16,7 +16,7 @@ echo '
# ex: ./'$ME' # ex: ./'$ME'
# SURVEY received #astroport-swarmkey ipfs_swarm.key.crypt for IPFS # SURVEY received #astroport-swarmkey ipfs_swarm.key.crypt for IPFS
######################################################################## ########################################################################
___DESACTIVATED___ TODO testing.
__ __ _ _ __ __ _ _
(_ (_ |_) _ ._ _ _|_o| (_ (_ |_) _ ._ _ _|_o|
__)__)|_) _>|_||\/(/_\/ | ||(/__> __)__)|_) _>|_||\/(/_\/ | ||(/__>