diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-11-10 19:31:28 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-11-10 19:31:28 +0000 |
commit | 963485457e18bf66223fb4e748c16269cc807a34 (patch) | |
tree | 1a45fc241827202bdc8adb9573402aeeaf2e5782 /lib | |
parent | d5a9fbf7123b65ca0eb01e2430be0c3fd2fc313a (diff) | |
download | acf-core-963485457e18bf66223fb4e748c16269cc807a34.tar.bz2 acf-core-963485457e18bf66223fb4e748c16269cc807a34.tar.xz |
Modified processinfo to make pidof check for a .pid file in /var/run.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1588 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/processinfo.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/processinfo.lua b/lib/processinfo.lua index 33ece60..e30d17a 100644 --- a/lib/processinfo.lua +++ b/lib/processinfo.lua @@ -177,8 +177,19 @@ local function is_cmdline(path, name) end end +local function has_pidfile(name) + local pid + local f = io.popen(path .. "find /var/run/ -name "..name..".pid") + local file = f:read("*a") + f:close() + if file and string.find(file, "%w") then + pid = fs.read_file(string.match(file, "^%s*(.*%S)")) + end + return pid +end + function pidof(name) - local pids = {} + local pids = {has_pidfile(name)} local i, j for i,j in pairs(posix.glob("/proc/[0-9]*")) do |