From 333cb703da2fbe639e6eb9d630e4f4221cc26d36 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Fri, 26 Oct 2018 13:28:37 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=20touch-=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D0=BC?= =?utf8?q?=D0=BE=D0=BD=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=D0=B0=20?= =?utf8?q?=D1=81=D1=82=D0=B5=D0=BF=D0=B5=D0=BD=D0=B8=20=D0=B6=D0=B8=D0=B2?= =?utf8?q?=D0=BE=D1=81=D1=82=D0=B8,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?utf8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D0=BF=D1=86=D0=B8=D0=B8=20=D0=B4?= =?utf8?q?=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB?= =?utf8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- weathermon.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/weathermon.lua b/weathermon.lua index 683d406..72e4895 100755 --- a/weathermon.lua +++ b/weathermon.lua @@ -83,6 +83,7 @@ function getConfig(configname) end logging = cur.get(config,"logging","enabled") + touch_file = cur.get(config,"logging","touch_file") serial_port = cur.get(config,"serial","port") serial_baud = cur.get(config,"serial","baud") @@ -125,6 +126,13 @@ function getConfig(configname) end +function touch() + if touch_file then + local file = io.open(touch_file, 'w') + file:close() + end +end + function sleep(sec) socket.select(nil, nil, sec) end @@ -153,7 +161,10 @@ end function printLog(str) if logging=="on" then capture("logger -t weathermon "..str) - else + print(str) + elseif logging=="syslog" then + capture("logger -t weathermon "..str) + elseif logging=="stdout" then print(str) end end @@ -176,6 +187,8 @@ function submitValue(type,id,param,val) result = capture(command) + touch() + end function processJson(str) -- 2.34.1