From: Steven Barth Date: Mon, 27 Jul 2009 12:28:34 +0000 (+0000) Subject: Add luci.lucid.running() X-Git-Tag: 0.10.0~1289 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=45cf10a665c6b7434cd44659426217d80865b3e1 Add luci.lucid.running() --- diff --git a/libs/lucid/luasrc/lucid.lua b/libs/lucid/luasrc/lucid.lua index d743269fe..4feb159a5 100644 --- a/libs/lucid/luasrc/lucid.lua +++ b/libs/lucid/luasrc/lucid.lua @@ -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"))