Add luci.lucid.running()
authorSteven Barth <steven@midlink.org>
Mon, 27 Jul 2009 12:28:34 +0000 (12:28 +0000)
committerSteven Barth <steven@midlink.org>
Mon, 27 Jul 2009 12:28:34 +0000 (12:28 +0000)
libs/lucid/luasrc/lucid.lua

index d743269..4feb159 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"))