#!/usr/bin/lua
local json = require("json")
+local signal = require("posix.signal")
require "wm_util"
getConfig(arg[1])
+signal.signal(signal.SIGTERM, function(signum)
+
+ printLog("Terminating...")
+ local pids = get_children()
+ for k,v in pairs(pids) do
+ printLog("Terminating subprocess "..tostring(v).."...")
+ signal.kill(v,signal.SIGTERM)
+ end
+ printLog("Exiting...")
+ os.exit(0)
+
+end)
+
if backlogdb or logdb then
local dbdriver = require "luasql.sqlite3"
env = assert(dbdriver.sqlite3())
}
stop_service() {
- killall weathermon
- killall weathermon-iio
/usr/bin/weather-backup
}
#!/usr/bin/lua
local socket = require "socket"
+local lfs = require "lfs"
+local uci = require "uci"
+local posix = require "posix"
function startswith(String,Start)
if String then
end
function list_dir(name)
- local lfs = require "lfs"
local result = {}
for name in lfs.dir(name) do
if not startswith(name,".") then
function get_devid(config)
- local uci = require "uci"
-
local web_devid = uci.get(config,"web","devid")
if web_devid then
local web_devid = io.read("*line")
return web_devid:gsub(":",""):upper()
-end
\ No newline at end of file
+end
+
+function get_children()
+
+ local pid = posix.getpid()
+ local pidlist = list_dir('/proc')
+ local pids = {}
+
+ for k,v in pairs(pidlist) do
+
+ pcall( function ()
+ local stats = get_file_content('/proc/'..v..'/stat')
+ local ppid = tonumber(split(stats,' ')[4])
+ if pid == ppid then
+ pids[#pids+1] = tonumber(v)
+ end
+ end)
+
+ end
+
+ return pids
+
+end
yAxes: [{
scaleLabel: {
display: true,
- labelString: properties["names"][sensor+"."+param],
+ labelString: properties["names"][devid+"."+sensor+"."+param] + ", " + properties["units"][devid+"."+sensor+"."+param],
fontColor: properties["fonts"]["axes"]["color"],
fontSize: properties["fonts"]["axes"]["size"],
fontStyle: properties["fonts"]["axes"]["style"],
+++ /dev/null
-<?php
-
- $mysql_host = 'estia.rvb-home.lan';
- $mysql_schema = 'meteo';
- $mysql_user = 'meteo';
- $mysql_pwd = 'snovadozhdi';
- $mysql_port = 3306;
-
- setlocale(LC_ALL,'ru_RU.UTF8');
-
- $site_header = 'RVB.NAME';
-
-?>