From 215deda60d6e1e5bb450bf8b157af742ada69f12 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:43:16 +0100 Subject: [PATCH] #428 count under-voltage reports --- home.admin/00infoBlitz.sh | 6 +++--- home.admin/_background.sh | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index da69057..66da094 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -289,7 +289,7 @@ ${color_yellow}${ln_publicColor}${ln_external} "-------------------------------------------" \ "load average:${load##up*, }" "${temp}" \ "${hdd}" "${sync_percentage}" -if [ "${runBehindTor}" != "on" ]; then - # one extra space line at the end if nodeaddress is not TOR - echo "" + +if [ ${#undervoltageReports} -gt 0 ]; then + echo "${countReports} undervoltage reports found in syslog" fi diff --git a/home.admin/_background.sh b/home.admin/_background.sh index f9310a1..35204b5 100644 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -60,6 +60,25 @@ do fi + #################################################### + # CHECK FOR UNDERVOLTAGE REPORTS + # every 1 hour scan for undervoltage reports + #################################################### + recheckUndervoltage=$(($counter % 3600)) + if [ ${recheckUndervoltage} -eq 1 ]; then + echo "*** RECHECK UNDERVOLTAGE ***" + countReports=$(sudo cat /var/log/syslog | grep -c "Under-voltage detected!") + echo "${countReports} undervoltage reports found in syslog" + if [ ${#undervoltageReports} -eq 0 ]; then + # write new value to info file + undervoltageReports="${countReports}" + echo "undervoltageReports=${undervoltageReports}" >> ${infoFile} + else + # update value in info file + sed -i "s/^undervoltageReports=.*/undervoltageReports=${countReports}/g" ${infoFile} + fi + fi + #################################################### # RECHECK PUBLIC IP # when public IP changes, restart LND with new IP