From 12ca09cbcf933b76952b5039a7c1aeb075e976ff Mon Sep 17 00:00:00 2001 From: qo-op Date: Tue, 30 Mar 2021 01:17:26 +0200 Subject: [PATCH] RUN TIME --- cron_MINUTE.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 856169a..1edab6b 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -56,8 +56,10 @@ ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2>&1>/dev/null && echo export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1) ######################################################################## cd $MY_PATH - -# WHAT UNIVERSAL TIME is it ? + +######################################################################## +# WHAT TIME(s) is it ? +timestamp="$(date -u +%s%N | cut -b1-13)" minute=$(date -u +%M) heure=$(date -u +%H) timebar="$heure:$minute" @@ -65,7 +67,29 @@ dayoftheweek=$(date +%w) dayofthemonth=$(date +%d) weeknumber=$(date +%V) -echo $timebar +# WAKEUP TIME +if [[ ! -f /tmp/A_Station_ON ]]; then +echo "onheure=$heure; onminute=$minute; ontimebar=$timebar" > /tmp/A_Station_ON +else +source /tmp/A_Station_ON +old=$ontimebar +new=$timebar +# feeding variables by using read and splitting with IFS +IFS=: read old_hour old_min <<< "$old" +IFS=: read hour min <<< "$new" +# convert hours to minutes +# the 10# is there to avoid errors with leading zeros +# by telling bash that we use base 10 +total_old_minutes=$((10#$old_hour*60 + 10#$old_min)) +total_minutes=$((10#$hour*60 + 10#$min)) +runtime=$((total_minutes - total_old_minutes)) +fi +# RUN TIME $runtime + +echo "$runtime ($timebar)" + +######################################################################## +# STATION CAN MODIFY DEFCON (cool 5 to 1 war) - only 5 and 4 (fail2ban) are ready to use. [[ -f ~/.zen/DEFCON ]] && export DEFCON=$(cat ~/.zen/DEFCON) || export DEFCON=$(cat ~/.zen/astrXbian/DEFCON) # ADAPT $DEFCON scenario # ____ _______ __ __ @@ -95,12 +119,12 @@ fi # __/ // /_/ ___/ ______ __________ ___ / __ \ # /_ _ __/\__ \ | /| / / __ `/ ___/ __ `__ \/ / / / # /_ _ __/___/ / |/ |/ / /_/ / / / / / / / / /_/ / -# /_//_/ /____/|__/|__/\__,_/_/ /_/ /_/ /_/\____/ +# /_//_/ /____/|__/|__/\__,_/_/ /_/ /_/ /_/\____/ gchange sync # ################################################################## # -# MAINTAIN FRESH LOCAL SWARM DATA EVERY 2 1/4 hours +/- 3 minutes -[[ $(($heure % 2)) == 0 && $minute == 15 ]] && sleep $((1 + RANDOM % 180)) && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh & +# MAINTAIN FRESH LOCAL SWARM DATA EVERY 2 hours +/- 3 minutes +[[ $(($runtime % 120)) == 0 ]] && sleep $((1 + RANDOM % 180)) && $MY_PATH/zen/gchange_INIT.sh && $MY_PATH/zen/gchange_IPFS_swarm.sh & # ~/astroport # _ _