|
Howdy:
I want to execute background processes concurrently from a lua script
like :
a = io.popen("deploy.exp" .. ip1):read("*a")
b = io.popen("deploy.exp" .. ip2):read("*a")
where a,b are continually running processes. When i do this as above, b will only run when a is finished. And the deploy.exp script is an expect script which
used to ssh few servers, and execute some commands. Then I need to fetch some text from a and b. Any idea on this? I tryed with the ExtensionProposal API.
When I tried that I get one error messages that say: "*** glibc detected *** free(): invalid next size (fast): 0x08aa2300 *** abort".
The part code is
for k,v in pairs(single) do
command = k .. " 1 " .. table.concat(v, " ")
local out = io.pipe()
local pro = assert(os.spawn("./spaw.exp " .. command,{
stdout = out,
}))
if not proc then error("Failed to aprogrinate! "..tostring(err)) end
print(string.rep("#", 50))
local exitcode = proc:wait()
end
Has anybody any experience (or advice / where we should look) with this? or give me a sample? Thanks
BTW:
I tried the luaposix, but I can't find any sample by posix.fork(). Does anyone
could share one? TKS
--------------
ms2008vip
2012-11-05
|