修复,action为toggle时截取的字符串错误

This commit is contained in:
Bujue.Win10 2022-03-04 18:32:09 +08:00
parent 89709b0ac1
commit 8a9935b90f
2 changed files with 6 additions and 3 deletions

View File

@ -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)
}

View File

@ -7,3 +7,6 @@ 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 &
ps | grep -v 'ps \| grep' | grep -E 'awk -f|tail -f' | awk '{print $1}' | xargs kill