From 8a9935b90f195d757a37ec84b2223e1ee6edb63c Mon Sep 17 00:00:00 2001 From: "Bujue.Win10" Date: Fri, 4 Mar 2022 18:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=8Caction=E4=B8=BAtoggl?= =?UTF-8?q?e=E6=97=B6=E6=88=AA=E5=8F=96=E7=9A=84=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logDataClean.awk | 4 ++-- start_monitor.sh | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/logDataClean.awk b/logDataClean.awk index 28f7ad5..2f8a610 100644 --- a/logDataClean.awk +++ b/logDataClean.awk @@ -66,12 +66,12 @@ $0~/action<[0-9]+> is toggle./ { atime = match($0,/[0-9]{1,2}-[0-9]{1,2} ([0-9]{1,2}:){3}[0-9]{1,3}/) ? substr($0,RSTART,RLENGTH) : null; if((getline conditionLine) > 0){ - adps = match(conditionLine,/toggle action: \{.*\}\}/) ? substr(substr($0,RSTART,RLENGTH),16,RLENGTH-15) : "\"not substr cmd\"" + adps = match(conditionLine,/toggle action: \{.*\}\}/) ? substr(substr(conditionLine,RSTART,RLENGTH),16,RLENGTH-15) : "\"not substr cmd\"" }else{ print "no more line" } - aLogJson = "{ \"time\":"atime", \"event\":\"action\", \"cmd\":"adps"}" + aLogJson = "{ \"time\":"atime", \"event\":\"action\", \"cmd\":"adps", \"toggleAction\":true}" log2file(aLogJson) } diff --git a/start_monitor.sh b/start_monitor.sh index 12c09ce..2867093 100644 --- a/start_monitor.sh +++ b/start_monitor.sh @@ -6,4 +6,7 @@ ssh root@192.168.1.30 cd /tmp && tftp 192.168.1.5 -g -l logDataClean.awk -tail -f /tmp/tuya.log | awk -f logDataClean.awk > /dev/null & \ No newline at end of file +tail -f /tmp/tuya.log | awk -f logDataClean.awk > /dev/null & + + +ps | grep -v 'ps \| grep' | grep -E 'awk -f|tail -f' | awk '{print $1}' | xargs kill \ No newline at end of file