Add luci.lucid.running()
[project/luci.git] / libs / lucid / luasrc / lucid.lua
index d743269fe3fbe2c4c0a2e3f7c3a75dcbddc9a15e..4feb159a50a6c662665e77d352fbe315b58b81ff 100644 (file)
@@ -60,6 +60,12 @@ function start()
        run()
 end
 
+--- Returns the PID of the currently active LuCId process.
+function running()
+       local pid = tonumber(state:get(UCINAME, "main", "pid"))
+       return pid and nixio.kill(pid, 0) and pid
+end
+
 --- Stops any running LuCId superprocess. 
 function stop()
        local pid = tonumber(state:get(UCINAME, "main", "pid"))