aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
authoronefang2019-12-24 21:20:51 +1000
committeronefang2019-12-24 21:20:51 +1000
commitb35794808bd93a3489565c3b9886a7c995463623 (patch)
tree0601e5daa671f73411835e31ee65e25ce8d3ee95 /apt-panopticommon.lua
parentRefactor logging. (diff)
downloadapt-panopticon-b35794808bd93a3489565c3b9886a7c995463623.zip
apt-panopticon-b35794808bd93a3489565c3b9886a7c995463623.tar.gz
apt-panopticon-b35794808bd93a3489565c3b9886a7c995463623.tar.bz2
apt-panopticon-b35794808bd93a3489565c3b9886a7c995463623.tar.xz
Everyone gets a car, er I mean linky!
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index 54e2be1..ea6346e 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -317,13 +317,14 @@ APT.html = false
317 317
318APT.logName = function(host, a2, a3) 318APT.logName = function(host, a2, a3)
319 local name = host 319 local name = host
320 if nil ~= a2 then name = name .. "_" .. a2 end 320 if (nil ~= a2) and ('' ~= a2) then name = name .. "_" .. a2 end
321 if nil ~= a3 then name = name .. "_" .. a3 end 321 if (nil ~= a3) and ('' ~= a3) then name = name .. "_" .. a3 end
322 return 'results/LOG_' .. name .. '.html' 322 name = 'LOG_' .. name .. '.html'
323 return {'results/' .. name, '<a href="' .. name:gsub("/", "_") .. '">' .. name:gsub("/", "_") .. '</a>'}
323end 324end
324 325
325APT.logOpen = function(host, a2, a3) 326APT.logOpen = function(host, a2, a3)
326 local name = APT.logName(host, a2, a3) 327 local name = APT.logName(host, a2, a3)[1]
327 if APT.checkFile(name) then return false end 328 if APT.checkFile(name) then return false end
328 APT.logFile, e = io.open(name, "a+") 329 APT.logFile, e = io.open(name, "a+")
329 if nil == APT.logFile then C('opening log file (' .. name .. ') - ' .. e); return false end 330 if nil == APT.logFile then C('opening log file (' .. name .. ') - ' .. e); return false end
@@ -422,7 +423,7 @@ APT.testing = function(t, host)
422end 423end
423 424
424APT.execute = function (s) 425APT.execute = function (s)
425 D(" executing <pre><code>" .. s .. "</code></pre>") 426 D(" executing - &nbsp; <code>" .. s .. "</code>")
426 --[[ Damn os.execute() 427 --[[ Damn os.execute()
427 Lua 5.1 says it returns "a status code, which is system-dependent" 428 Lua 5.1 says it returns "a status code, which is system-dependent"
428 Lua 5.2 says it returns true/nil, "exit"/"signal", the status code. 429 Lua 5.2 says it returns true/nil, "exit"/"signal", the status code.
@@ -441,7 +442,7 @@ APT.execute = function (s)
441end 442end
442 443
443APT.fork = function(s) 444APT.fork = function(s)
444 D(" forking <pre><code>" .. s .. "</code></pre>") 445 D(" forking - &nbsp; <code>" .. s .. "</code>")
445 os.execute(s .. " &") 446 os.execute(s .. " &")
446end 447end
447 448