projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
466c75a
)
Добавлен touch-файл для мониторинга степени живости, добавлены опции для протоколиров...
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 26 Oct 2018 10:28:37 +0000
(13:28 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 26 Oct 2018 10:28:37 +0000
(13:28 +0300)
weathermon.lua
patch
|
blob
|
history
diff --git
a/weathermon.lua
b/weathermon.lua
index 683d40697a1e2a068b868bb15a0d4f85d2c17717..72e48952e83bb12a392df46dd5ff75ff3ff23d83 100755
(executable)
--- a/
weathermon.lua
+++ b/
weathermon.lua
@@
-83,6
+83,7
@@
function getConfig(configname)
end
logging = cur.get(config,"logging","enabled")
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")
serial_port = cur.get(config,"serial","port")
serial_baud = cur.get(config,"serial","baud")
@@
-125,6
+126,13
@@
function getConfig(configname)
end
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
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)
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
print(str)
end
end
@@
-176,6
+187,8
@@
function submitValue(type,id,param,val)
result = capture(command)
result = capture(command)
+ touch()
+
end
function processJson(str)
end
function processJson(str)