From 26f47d69c4851c9f73acc11b2d5d5d255b6e0b98 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Tue, 20 Jul 2021 17:55:56 -0700 Subject: [PATCH] deal w/ IndexError, and keep running as it closes often.. --- streaming | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/streaming b/streaming index c4ce8b2..f10fb29 100644 --- a/streaming +++ b/streaming @@ -1,6 +1,7 @@ #!/bin/sh -curl --no-buffer --digest -u installer:$(cat creds.inst.txt) http://$(read a b << EOF +while sleep .1; do + curl --no-buffer --digest -u installer:$(cat creds.inst.txt) http://$(read a b << EOF $(cat creds.txt) EOF echo $a)/stream/meter 2>/dev/null | python3.8 -c 'import time; import sys @@ -11,5 +12,9 @@ for i in inp: i = i.strip() if not i: continue - i = i.split(maxsplit=1)[1] + try: + i = i.split(maxsplit=1)[1] + except IndexError: + continue print(time.time(), i)' > home.power.$(date +%Y%m%d%H%M).log +done