From 21260a74f42a65603317d1938fac675d5eef6635 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Thu, 23 Jan 2020 10:24:52 +0300 Subject: [PATCH] =?utf8?q?=D0=A2=D1=80=D0=B0=D0=BD=D0=B7=D0=B0=D0=BA=D1=86?= =?utf8?q?=D0=B8=D0=BE=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=B0=20=D1=81=20=D0=91=D0=94=20=D0=B4=D0=BB=D1=8F=20?= =?utf8?q?=D0=B8=D0=B7=D0=B1=D0=B5=D0=B6=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B1?= =?utf8?q?=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=BE=D0=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/dump-yesterday | 2 +- bin/weather-backup | 4 ++-- bin/weather-filter | 2 +- bin/weather-watchdog | 3 ++- bin/weathermon | 5 ++++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/dump-yesterday b/bin/dump-yesterday index d96d3dd..c9e1eaf 100755 --- a/bin/dump-yesterday +++ b/bin/dump-yesterday @@ -12,6 +12,6 @@ if [ -f "$logdb" ]; then /usr/bin/weather-filter $logdb dump-compacted $yesterday $dumpdir - sqlite3 $logdb "delete from log where time_stamp /dev/null || /etc/init.d/weather-display restart +pgrep weather-lcd > /dev/null || /etc/init.d/lcd-weather restart diff --git a/bin/weathermon b/bin/weathermon index bd9ca80..dbffa82 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -105,13 +105,17 @@ function submitValue(type,id,param,val) if code ~= 200 and backlog_con then printLog("writing record to backlog...") + backlog_con:execute('BEGIN TRANSACTION') backlog_con:execute(string.format("INSERT INTO queue(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) + backlog_con:execute('COMMIT') end end if logdb then + log_con:execute('BEGIN TRANSACTION') log_con:execute(string.format("INSERT INTO log(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) + log_con:execute('COMMIT') end end @@ -408,7 +412,6 @@ while 1 do io.close(f) end) end - end) end -- 2.34.1