RUN TIME
This commit is contained in:
parent
a3a5c1b5db
commit
12ca09cbcf
|
@ -57,7 +57,9 @@ export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=
|
|||
########################################################################
|
||||
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
|
||||
# _ _
|
||||
|
|
Loading…
Reference in New Issue