From e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9 Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 28 Dec 2019 00:24:18 +1000 Subject: A better way to clean up after the archiving, no need to wait for it. --- apt-panopticon.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 72627a0..e54e553 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -1064,7 +1064,10 @@ else local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") local adt = fadt:read('*l') fadt:close() - if (nil ~= adt) and APT.checkFile(adt) then os.execute('mkdir -p ' .. adt:sub(1, 18) .. '; ionice -c3 nice -n 19 tar -c --xz ' .. adt .. ' -f ' .. adt:sub(1, 18) .. '/' .. adt .. '.tar.xz &') end + if (nil ~= adt) and APT.checkFile(adt) then + os.execute('{ mkdir -p ' .. adt:sub(1, 18) .. ' && ionice -c3 nice -n 19' .. + ' tar -c --xz ' .. adt .. ' -f ' .. adt:sub(1, 18) .. '/' .. adt .. '.tar.xz && rm -fr ' .. adt .. ' 2>/dev/null; } &') + end local dt = os.date('!%F-%H-%M') local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') local odt = fodt:read('*l') @@ -1212,10 +1215,6 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. end end -os.execute('sleep 1') -- Wait for things to start up before checking for them. - while 1 <= APT.checkExes('tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz') do os.execute("sleep 10") end - if nil ~= adt then os.execute('rm -fr ' .. adt .. ' 2>/dev/null') end - I('Total run time was ' .. (os.time() - now) .. ' seconds.') APT.logPost() end -- cgit v1.1