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