ASTROPORT Bot runs every minute

This commit is contained in:
qo-op 2021-01-31 23:18:56 +01:00
parent bdbdfab86c
commit a05deb248d
1 changed files with 38 additions and 58 deletions

View File

@ -32,15 +32,12 @@ export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep'
# |__/|__/_/ |_/_/ |_/_/ |_/___/_/ |_/\____/ (_|_)
########################################################################
# NB: 'figlet' is used for labeling code trunks
# 'figlet' was used for labeling code trunks
########################################################################
### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!!
### EVERY STATION RUN THIS SCRIPT EVERY MINUTE.
export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
export isinotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | 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/.12D3KooW***/ )
########################################################################
cd $MY_PATH
@ -53,6 +50,8 @@ dayofthemonth=$(date +%d)
weeknumber=$(date +%V)
echo $timebar
DEFCON=$(cat $MY_PATH/DEFCON) # TODO SELECT $DEFCON scenario
# ____ _______ __ __
# / __ \/ ____/ | / / ____ ___ ____ ____/ /__
@ -88,18 +87,17 @@ fi
# /_/\_\_.__/|_|\__,_|_| |_| ASTROPORT youtube mp3
#
# Transfert ~/astroport/*/files to IPFS and make Vstream/ASTROPORT indexes on IPNS
if [[ "$USER" == "xbian" ]]; then
if [[ ! $isinotifywaitRunning ]]; then
mkdir -p /home/$YOU/astroport
/usr/bin/inotifywait -r -e close_write -m /home/$YOU/astroport | while read dir flags file; do $MY_PATH/zen/mint_youtube.sh "$dir" "$file"; done &
fi
if [[ ! $isinotifywaitRunning ]]; then
mkdir -p /home/$YOU/astroport
#[[ $YOU == "xbian" ]] && /usr/bin/inotifywait -r -e close_write -m /home/$YOU/astroport | while read dir flags file; do $MY_PATH/zen/xbian_vstream.sh "$dir" "$file"; done &
/usr/bin/inotifywait -r -e close_write -m /home/$YOU/astroport | while read dir flags file; do $MY_PATH/zen/mint_youtube.sh "$dir" "$file"; done &
# restart inotifywait (may be useless)
if [[ "$timebar" == "03:03" ]]; then
killall inotifywait
fi
fi
# restart inotifywait (may be useless)
if [[ "$timebar" == "03:03" ]]; then
killall inotifywait
fi
## TODO investigate could breaks "ipfs p2p" forwards ?
##################################################################
@ -110,14 +108,14 @@ fi
# \____//_/ /_/ /_/|_| /_/ /_/ /_/\____/_/ /_/_/\__/\____/_/
#
##################################################################
# MONITOR INPUT TX (TODO: DEBUG)
# Activate later for DAB ZenTx Machines
# 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"
##################################################################
##################################################################
##################################################################
# MIDNIGHT:01 : ZENBOT CLEANING & UPDATE
# MIDNIGHT:01 : CLEANING & UPDATE
##################################################################
##################################################################
if [[ "$timebar" == "00:01" ]]; then
@ -135,57 +133,39 @@ echo '
############################## That swarm could become an aggressive blob !!
### PEACE & LOVE software is processing... We are HyperWeb people here.
# DEFCON 5 quiet behaviour so Please keep cool, take care and be zen.
# GOOD BYE GOOGLE, AMAZON, FACEBOOK, APPLE, MICROSOFT. We don't need you.
##################################################################
# GOOD BYE GOOGLE, AMAZON, FACEBOOK, APPLE, MICROSOFT. LIBRE WE ARE.
####################################################################
# REFRESH & UPGRADE youtube-dl
youtube-dl --rm-cache-dir
youtube-dl -U
#### DESYNC
sleep $((1 + RANDOM % 5))
##################################################################
# ssb_INIT + LOG ROTATE EVERY SUNDAY # TODO /var/log/ + logrotate (& tempfiles in /tmp in RAMFS)
if [[ $dayoftheweek == 0 ]]; then
#$MY_PATH/zen/gchange_INIT.sh &
echo "ACTIVATE"
# ACTIVATE IF CRON LOGGING
#tar cvzf ~/.zen/astrXbian.$weeknumber.log.tgz /tmp/astroport.log # LOG BACKUP FOR 1 YEAR !!
fi
#### DESYNC
#### DESYNC
sleep $((1 + RANDOM % 5))
##################################################################
git pull # UPDATE CODE git pull
##################################################################
echo '
_________ ______
____ ___ ____ /_ __/ | / ____/
/_ / / _ \/ __ \ / / / /| |/ / __
/ /_/ __/ / / / / / / ___ / /_/ /
/___/\___/_/ /_/ /_/ /_/ |_\____/
REFRESHing ZenTAG nano DHTs = Zen File ECONOMY
'
#
# _________ ______
# ____ ___ ____ /_ __/ | / ____/
# /_ / / _ \/ __ \ / / / /| |/ / __
# / /_/ __/ / / / / / / ___ / /_/ /
# /___/\___/_/ /_/ /_/ /_/ |_\____/
#
# REFRESHing ZenTAG nano DHTs = Zen File ECONOMY
# ./zen/ipns_TAG_refresh.sh
##################################################################
if [[ $dayofthemonth == 7 ]]; then
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
echo '
_____ __ __ ___
/ ___// /_____ _________ _____ ____ / |/ /___ __ __
\__ \/ __/ __ \/ ___/ __ `/ __ `/ _ \ / /|_/ / __ `/ |/_/
___/ / /_/ /_/ / / / /_/ / /_/ / __/ / / / / /_/ /> <
/____/\__/\____/_/ \__,_/\__, /\___/ /_/ /_/\__,_/_/|_|
/____/
# 1/2 HDD for IPFS size - dicotomic adaptation 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 [[ $dayoftheweek == 0 ]]; then
#
'
# _____ __ __ ___
# / ___// /_____ _________ _____ ____ / |/ /___ __ __
# \__ \/ __/ __ \/ ___/ __ `/ __ `/ _ \ / /|_/ / __ `/ |/_/
# ___/ / /_/ /_/ / / / /_/ / /_/ / __/ / / / / /_/ /> <
# /____/\__/\____/_/ \__,_/\__, /\___/ /_/ /_/\__,_/_/|_|
# /____/
# 1/2 HDD for IPFS size - dicotomic adaptation 7th EVERY MONTH
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
echo "StorageMax = $diskSize"
fi