From fadda28c92cea8ed57e04c1dfef93697d76e55a8 Mon Sep 17 00:00:00 2001 From: habuild <36288425+habuild@users.noreply.github.com> Date: Sun, 31 Jul 2022 20:58:08 +1000 Subject: [PATCH] Update taillog.sh change logging method makes it green! --- haos-sbfspot/rootfs/usr/bin/sbfspot/taillog.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/haos-sbfspot/rootfs/usr/bin/sbfspot/taillog.sh b/haos-sbfspot/rootfs/usr/bin/sbfspot/taillog.sh index 900b455..066e8cb 100644 --- a/haos-sbfspot/rootfs/usr/bin/sbfspot/taillog.sh +++ b/haos-sbfspot/rootfs/usr/bin/sbfspot/taillog.sh @@ -2,17 +2,23 @@ cd / -#create lognow variable +#---- Create lognow variable lognow=$(date +%Y%m%d) # Sleep until log updated from last SBFspot run sleep 45 -# set tail to log out to HA log -# Use lognow variable to select latest file -echo '[SBFspot Upload Log Latest]' -tail -n1 /data/sbfspot/log/SBFspotUpload$lognow.log >> /proc/1/fd/1 +#---- set tail to log out to HA log +#---- Use lognow variable to select latest file +#---- Print tail of latest log +message=$(echo "[SBFspot Upload Log Latest] $(tail -n1 /data/sbfspot/log/SBFspotUpload$lognow.log)") + +## Print the message the user supplied, defaults to "Hello World..." +bashio::log.info "${message:="Hello World..."}" + + +#---- Delete old log files #busybox command for minus 1 day #date +%Y%m%d -d @$(($(date +%s)-86400))