g1sms LOVELAND ENTRANCE published on http://127.0.0.1:10099/sms_loveland.php
This commit is contained in:
parent
41693e8b00
commit
f31891acb6
|
@ -7,10 +7,14 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
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##*/}"
|
||||||
|
cd $MY_PATH
|
||||||
####
|
####
|
||||||
|
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"
|
||||||
# Add search in code "TODO".
|
export IPFSNODEID=$(ipfs id -f='<id>\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
|
# Write what you thing about the situation
|
||||||
# AND how you would like to 'fix it'...
|
# AND how you would like to 'fix it'...
|
||||||
# Then friends can read and enhance solution.
|
# 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)
|
# ? 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***/ )
|
### 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
|
# CORRECT PATH
|
||||||
[[ ! $(echo $PATH | grep "/usr/local/bin") ]] && export PATH="$PATH:/usr/local/bin"
|
[[ ! $(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 "~/.local/bin") ]] && export PATH="$PATH:~/.local/bin"
|
||||||
[[ ! $(echo $PATH | grep "/usr/games") ]] && export PATH="$PATH:/usr/games"
|
[[ ! $(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);
|
# WHAT UNIVERSAL TIME is it ?
|
||||||
export IPFSNODEID=$(ipfs id -f='<id>\n')
|
|
||||||
ipfsnodeid=$(ipfs id -f='<id>\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.
|
|
||||||
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)
|
dayoftheweek=$(date +%w)
|
||||||
jourdumois=$(date +%d)
|
dayofthemonth=$(date +%d)
|
||||||
numerosemaine=$(date +%V)
|
weeknumber=$(date +%V)
|
||||||
|
|
||||||
echo $timebar
|
echo $timebar
|
||||||
# TIME NTP SYNC: TODO: Problem being root (stickybit INSTALL?)
|
# 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
|
# sudo ntpdate ntp.pool.org
|
||||||
|
|
||||||
# ____ _______ __ __
|
# ____ _______ __ __
|
||||||
|
@ -69,7 +65,6 @@ echo $timebar
|
||||||
# ACTIVATE 5 MN "git pull" update
|
# ACTIVATE 5 MN "git pull" update
|
||||||
if [[ $(($minute % 5)) == 0 ]]; then
|
if [[ $(($minute % 5)) == 0 ]]; then
|
||||||
sleep $((1 + RANDOM % 12))
|
sleep $((1 + RANDOM % 12))
|
||||||
cd $MY_PATH
|
|
||||||
### Remove files being in .gitignore
|
### Remove files being in .gitignore
|
||||||
# git checkout -- www/LOVELand/jukebox/prefs/collection.sq3
|
# git checkout -- www/LOVELand/jukebox/prefs/collection.sq3
|
||||||
# git checkout -- www/LOVELand/jukebox/prefs/prefs.var
|
# 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
|
# [[ $(($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
|
# Clean & Upgrade + Log rotation + git pull + ipfs p2p port forward
|
||||||
##################################################################
|
'
|
||||||
# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE
|
|
||||||
if [[ "$timebar" == "00:01" ]]; then
|
|
||||||
sleep $((1 + RANDOM % 10)) ### Be careful if random sleep is not activated...
|
sleep $((1 + RANDOM % 10)) ### Be careful if random sleep is not activated...
|
||||||
############################## That swarm could become an aggressive blob !!
|
############################## That swarm could become an aggressive blob !!
|
||||||
### PEACE & LOVE software is processing... We are HyperWeb people here.
|
### PEACE & LOVE software is processing... We are HyperWeb people here.
|
||||||
|
@ -146,13 +143,12 @@ if [[ "$timebar" == "00:01" ]]; then
|
||||||
|
|
||||||
sleep $((1 + RANDOM % 10))
|
sleep $((1 + RANDOM % 10))
|
||||||
# LOG ROTATE EVERY SUNDAY
|
# 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))
|
sleep $((1 + RANDOM % 10))
|
||||||
|
|
||||||
# GIT UPDATE
|
# GIT UPDATE
|
||||||
./git-update.sh
|
./git-update.sh
|
||||||
|
|
||||||
git pull # UPDATE CODE git pull
|
git pull # UPDATE CODE git pull
|
||||||
|
|
||||||
# Clear 24h ssb_GET markers
|
# 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
|
ipfs p2p close --all
|
||||||
$MY_PATH/zen/ipfs_OPEN_ports.sh
|
./zen/ipfs_OPEN_ports.sh
|
||||||
ipfs p2p ls
|
ipfs p2p ls
|
||||||
|
|
||||||
fi
|
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.
|
# 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}')
|
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
|
||||||
diskSize="$((availableDiskSize / 2))"
|
diskSize="$((availableDiskSize / 2))"
|
||||||
ipfs config Datastore.StorageMax $diskSize
|
ipfs config Datastore.StorageMax $diskSize
|
||||||
|
|
|
@ -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"
|
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='<id>\n') || er+=" ipfs id problem"
|
IPFSNODEID=$(ipfs id -f='<id>\n') || er+=" ipfs id problem"
|
||||||
WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami 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)
|
# TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ if [[ $(which gammu) ]]; then
|
||||||
else
|
else
|
||||||
# Looking for g1sms NODE in my swarm
|
# 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)
|
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
|
[[ $SMSNODE ]] && ipfs p2p forward /x/g1sms /ip4/127.0.0.1/tcp/10099 /p2p/$SMSNODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue